How to Deploy and Verify a Contract on Base Mainnet
Learn how to deploy a smart contract on Base mainnet: test on Base Sepolia, fund your wallet with ETH on Base, deploy with Foundry and verify on Basescan.
To deploy a smart contract on Base mainnet, start with a compiled contract that passes its tests, test it on Base Sepolia, fund your deployer wallet with ETH on Base, then deploy and verify the source on Basescan. Base is EVM-equivalent, so Foundry and Hardhat work with Base once you set the right RPC and chain ID. The result is a live contract page with verified source code.
Have Foundry or Hardhat, a deployer wallet, ETH on Base, and an Etherscan API key ready. You can fund the wallet by withdrawing ETH from an exchange to the Base network or moving supported assets from Ethereum with the Base bridge. The Base bridge is a useful example of a cross-chain service because it lets users move supported assets between Ethereum and Base.
Deploy and verify your contract
- Deploy to Base Sepolia and test it. Set your test network to chain ID 84532, deploy the contract, and try its key functions. The visible result is a test deployment you can inspect before spending mainnet ETH.
- Fund the deployer with ETH on Base. Use an exchange withdrawal on the Base network or the Base bridge to move ETH from Ethereum. The wallet should now hold ETH on Base to pay deployment fees.
- Set Foundry to Base mainnet. Point your RPC at https://mainnet.base.org and set the chain ID to 8453. Enable the Solidity optimizer before compiling: larger bytecode raises the L1 data fee, which is part of the deployment cost alongside L2 execution gas.
- Broadcast the deployment. Run your Foundry deployment script with forge script and --broadcast. The transaction deploys the contract on Base mainnet; save its address and transaction details. With Hardhat, configure the same RPC and chain ID, then run your deployment script for that network.
- Verify the source on Basescan. Submit the matching source and compiler settings with your Etherscan API key. When verification succeeds, the Basescan page shows the source code and the Read and Write Contract tabs. That verified page confirms the task is done.
There is a useful address detail when testing. A CREATE contract address depends only on the deployer address and its transaction nonce. Say you use a fresh wallet whose nonce is 0 on both Base Sepolia and Base mainnet: deploying from that wallet at nonce 0 on each chain gives the contract the same address. This can make it easier to compare test and live deployments, though each chain still has its own contract state.
Base’s EVM compatibility lets familiar Ethereum tools handle deployment; the key is matching the network settings and verifying the exact compiled source. Once Basescan shows verified code, you have a public page for the live contract.
Related questions
How much does it cost to deploy a contract on Base?
The cost combines L2 execution gas and an L1 data fee. The fee varies with network conditions and bytecode size, so optimizing before deployment can reduce the data the deployment needs to publish.
Where can I get Base Sepolia testnet ETH?
Get Base Sepolia ETH from a testnet faucet, then use it to deploy and test on chain ID 84532 before funding a mainnet deployment.
What to consider after deployment
How do I make a contract upgradeable on Base?
Choose an upgrade pattern, such as a proxy, before deployment. The proxy and implementation need careful testing because upgrade permissions control future contract logic.
Can I deploy the same contract on other OP Stack chains?
Often, yes. Check that the target chain supports the contract’s dependencies, then configure its RPC and chain ID and deploy there separately.
How do I sponsor gas for my users on Base?
Use a gas sponsorship setup that supports Base, and define which user transactions qualify. Test the rules and funding flow before enabling sponsorship in your app.
How do I get my dApp listed in the Base ecosystem?
Prepare a working dApp, its contract addresses, and clear project details, then check the current Base ecosystem submission process for listing requirements.