Skip to content

Deployment overview

Hardhat’s flexibility allows you to deploy your smart contracts in multiple ways. We also provide an official deployment solution: Hardhat Ignition, which we strongly recommend.

In this section we’ll prepare the common setup and config to deploy and initialize a contract to Sepolia in the next two guides:

Both guides assume you initialized a project based on viem or ethers using hardhat --init. If you didn’t, follow the Getting started guide first.

You’ll need access to a Sepolia RPC URL and an account with Sepolia ETH. We’ll set them up next.

If you followed the Getting started guide, your config should look something like this:

// ... some imports ...
export default defineConfig({
// ... other config ...
networks: {
// ... other network config ...
sepolia: {
type: "http",
chainType: "l1",
url: configVariable("SEPOLIA_RPC_URL"),
accounts: [configVariable("SEPOLIA_PRIVATE_KEY")],
},
},
});

Make sure you have the sepolia section, highlighted above.

Storing the required secrets in the Hardhat Keystore

Section titled “Storing the required secrets in the Hardhat Keystore”

If you haven’t done this while following another guide, store the values for SEPOLIA_RPC_URL and SEPOLIA_PRIVATE_KEY using the hardhat-keystore plugin to save them in an encrypted vault.

To do it, run:

Terminal window
npx hardhat keystore set SEPOLIA_RPC_URL

After entering your keystore password, you’ll be able to set the RPC URL.

Then run:

Terminal window
npx hardhat keystore set SEPOLIA_PRIVATE_KEY

to set a private key.

With the setup in place, you can now: