Walk me through how you deploy a set of contracts to mainnet safely.
What the interviewer wants to hear
- Scripted, repeatable deployments (Foundry scripts) tested on a fork and testnet
- Pinned compiler version, settings and EVM version per chain
- Secure keys: hardware wallet or multisig, not a plain env file
- Verify source on explorers and check deployed config with a script
- Hand ownership to multisig, record addresses, set up monitoring
Model answer
I write the deployment as a Foundry script so it is repeatable and reviewed like normal code. I first run it against a mainnet fork, then on a testnet, and check the results with post-deployment tests that read every important setting. The compiler version, optimizer runs and EVM version are pinned, and checked per target chain. For the real deployment I sign with a hardware wallet or a dedicated deployer key, never a key sitting in a plain env file, and I use CREATE2 if I want the same addresses across chains. Right after deploying I verify the source on Etherscan or the chain's explorer, run a script that checks owners, roles and parameters, and transfer ownership to the multisig or timelock. Finally I publish the addresses, store the deployment artifacts in the repo, and turn on monitoring and alerts.
Can you answer it under time pressure?
Take a timed medium round and get scored on every answer.
More medium Blockchain Developer questions
- What is a reentrancy attack and how do you prevent it?
- What techniques do you use to reduce gas costs in Solidity contracts?
- How do you test a smart contract before deploying it to mainnet?
- How do upgradeable smart contracts work, and what are the trade-offs?
- What is a blockchain oracle and how do you use price data safely?
- How do signature-based approvals like ERC-2612 permit and Permit2 work, and what are their risks?
- How do you build a reliable dApp frontend that reads and writes contracts with viem and wagmi?
- How do chain reorganizations affect a dApp or backend service, and how do you handle them?
- How do you design admin control for a protocol so it can be maintained without making users trust a single person?