How do I deploy to Ethereum mainnet from Hardhat?

Viewed 3942

So I have followed multiple tutorials on getting started with smart contract development in Ethereum and have read many, many pages on security and development in OpenZeppelin. How exactly do I go about actually deploying my project to the Ethereum mainnet using Hardhat though? I can only find info on deploying to test networks!

1 Answers

Expand the networks section of the config file.

Example configuration:

mainnet: {
    url: "https://mainnet.infura.io/v3/<your_infura_key>", // or any other JSON-RPC provider
    accounts: [<your_private_key>]
}

Instead of specifying the private key directly, you can also specify the mnemonic phrase.

For more details, see the docs.

Related