Solidity is unforgiving. In traditional web dev, if you make a mistake, you deploy a hotfix. In Web3, you might lose money—permanently.
The Mistake: Immutable Variables
I deployed a contract with a hardcoded wallet address for receiving fees. I tested it on a testnet, everything worked. Then I deployed to Mainnet.
Five minutes later, I realized I had used my hardware wallet address, which I didn’t want to expose for this specific purpose. But it was too late. The contract code is immutable. I couldn’t change the address.
Access Control Issues
I also forgot to add the onlyOwner modifier to a critical configuration function. Luckily, I caught this before anyone else did, but it meant I had to redeploy the entire contract—costing another $100 in gas.
Lessons for Next Time
1. Audit, Audit, Audit: Use tools like Slither or MythX.
2. Upgradable Proxies: Learn how to use OpenZeppelin’s proxy patterns so you CAN fix bugs later.
3. Testnet Hygiene: Treat the testnet exactly like Mainnet.