Adding a Tip Jar to a Webpage
The previous tutorials drove the TipJar contract entirely from the shell. This one puts it behind a webpage: a Connect button, a tip form, a live balance, and a withdraw button that only appears for the owner. The browser flow is: Webpage → ethers.js → MetaMask → Anvil → TipJar contract MetaMask holds the keys and signs the transactions. No private key goes anywhere near the JavaScript. Frontend source is visible to anyone who visits the page, so a key in it is a key you have given away. ...