Skip to main content

Hardhat

Hardhat is an Ethereum development environment for flexible, extensible, and fast smart contract development.

You can use Hardhat to edit, compile, debug, and deploy your smart contracts to Base.


Using Hardhat with Base

To configure Hardhat to deploy smart contracts to Base, update your project’s hardhat.config.ts file by adding Base as a network:

networks: {
// for mainnet
"base-mainnet": {
url: 'https://mainnet.base.org',
accounts: [process.env.PRIVATE_KEY as string],
gasPrice: 1000000000,
},
// for Sepolia testnet
"base-sepolia": {
url: "https://sepolia.base.org",
accounts: [process.env.PRIVATE_KEY as string],
gasPrice: 1000000000,
},
// for local dev environment
"base-local": {
url: "http://localhost:8545",
accounts: [process.env.PRIVATE_KEY as string],
gasPrice: 1000000000,
},
},
defaultNetwork: "base-local",
info

For a complete guide on using Hardhat to deploy contracts on Base, see Deploying a Smart Contract.


We use cookies and similar technologies on our websites to enhance and tailor your experience, analyze our traffic, and for security and marketing. You can choose not to allow some type of cookies by clicking . For more information see our Cookie Policy.