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 mai.net using Hardhat though? I can only find info on deploying to test.networks!
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 .
In the context of hardhat, mai.net, tes.net or any other.network work in the same way. These are just the tags. you can define multiple.networks in hardhat config
module.exports = {
solidity: "0.8.9",
defaultNetwork: "hardhat",
networks: {
hardhat: {},
rinkeby: {
url: RAPI_URL,
accounts: [RINKEBY_WALLET_ADDRESS_PRIVATE_KEY]
},
mainnet: {
url: ETH_MAINNET_RPC_URL,
accounts: [MAINNET_WALLET_ADDRESS_PRIVATE_KEY]
},
},
}
then for deploy use the command like this
npx hardhat run scripts/deploy.js --network rinkeby
or
npx hardhat run scripts/deploy.js --network mainnet
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.