Deploying Smart Contracts to Base
Base is an L2 from Coinbase on OP Stack. Fully EVM-compatible: same Solidity, same ABI, same tools. Deploying a contract from Ethereum to Base — this is changing the --network flag and RPC URL. But there are nuances with verification, gas estimation and bridge for testing.
Hardhat Configuration
// hardhat.config.ts
import { HardhatUserConfig } from 'hardhat/config'
import '@nomicfoundation/hardhat-toolbox'
import '@nomicfoundation/hardhat-verify'
const config: HardhatUserConfig = {
solidity: {
version: '0.8.24',
settings: { optimizer: { enabled: true, runs: 200 } }
},
networks: {
base: {
url: 'https://mainnet.base.org',
accounts: [process.env.DEPLOYER_PRIVATE_KEY!],
chainId: 8453,
},
'base-sepolia': {
url: 'https://sepolia.base.org',
accounts: [process.env.DEPLOYER_PRIVATE_KEY!],
chainId: 84532,
},
},
etherscan: {
apiKey: {
base: process.env.BASESCAN_API_KEY!,
'base-sepolia': process.env.BASESCAN_API_KEY!,
},
customChains: [
{
network: 'base',
chainId: 8453,
urls: {
apiURL: 'https://api.basescan.org/api',
browserURL: 'https://basescan.org',
},
},
{
network: 'base-sepolia',
chainId: 84532,
urls: {
apiURL: 'https://api-sepolia.basescan.org/api',
browserURL: 'https://sepolia.basescan.org',
},
},
],
},
}
export default config
Deployment and Verification
# Deploy to Base Sepolia (testnet)
npx hardhat run scripts/deploy.ts --network base-sepolia
# Verify source code
npx hardhat verify --network base-sepolia <CONTRACT_ADDRESS> <constructor_arg1> <constructor_arg2>
For contracts with constructor arguments in ABI-encoded format — use arguments file:
npx hardhat verify --network base --constructor-args scripts/args.ts <CONTRACT_ADDRESS>
Foundry Variant
forge create --rpc-url https://mainnet.base.org \
--private-key $DEPLOYER_PRIVATE_KEY \
--etherscan-api-key $BASESCAN_API_KEY \
--verify \
src/MyContract.sol:MyContract \
--constructor-args <arg1> <arg2>
--verify verifies immediately after deployment. Foundry is faster than Hardhat for simple deployments.
Gas on Base
Base gas is paid in ETH. Gas price usually 0.001-0.01 gwei — orders of magnitude cheaper than mainnet. Typical costs:
| Operation | Gas | Approximate cost (at ETH $3000) |
|---|---|---|
| Simple contract deployment | ~500k gas | ~$0.01-0.05 |
| ERC-20 transfer | 21k-65k gas | < $0.001 |
| Uniswap V3 swap | ~180k gas | ~$0.003 |
For test ETH on Base Sepolia — Coinbase faucet (coinbase.com/faucets) or bridge from Ethereum Sepolia via Base bridge.
Deterministic Deployment with CREATE2
If you need same contract address on Base and other networks — CREATE2 via deterministic deployer:
// Use standard Nick's factory (0x4e59b44847b379578588920cA78FbF26c0B4956C)
bytes32 salt = keccak256("my-project-v1");
cast create2 --starts-with 0x1234 --init-code-hash <hash>
# Will find salt for vanity address starting with 0x1234
Contract address on Base, Optimism, Arbitrum and Ethereum will be identical with same bytecode and salt.







