Files
web/apps/base-docs/docs/tools/hardhat.md
2024-12-18 19:24:50 +00:00

1.6 KiB
Raw Permalink Blame History

title, slug, description, keywords, hide_table_of_contents
title slug description keywords hide_table_of_contents
Hardhat /tools/hardhat Documentation for configuring Hardhat for smart contract development on Base, including setup instructions for mainnet, testnet, and local development environments.
Hardhat
Base
Base network
Base mainnet
Base testnet
hardhat config
hardhat configuration
Ethereum development
smart contract
deployment
mainnet
testnet
local development
true

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 projects 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 Base 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.

:::