Hello Guys, I’m ready to deploy my contract to MainNet. I need some input so that the deployment would be smooth. Ive been using the gasPrice values in the truffl-config.js below when deploying to Ropsten. Do I need to adjust the gas and gasPrice values when I deploy to the MainNet? What would be the recommended values? Thanks in advance.
main: {
provider: function() {
return new HDWalletProvider(
privateKeys.split(','), // Array of account private keys
`https://main.infura.io/v3/${process.env.INFURA_PROJECT_ID}`// Url to an Ethereum Node
)
},
gas: 5000000,
gasPrice: 5000000000, // 5 gwei
network_id: 1
},
ropsten: {
provider: function() {
return new HDWalletProvider(
privateKeys.split(','), // Array of account private keys
`https://ropsten.infura.io/v3/${process.env.INFURA_PROJECT_ID}`// Url to an Ethereum Node
)
},
gas: 5000000,
gasPrice: 5000000000, // 5 gwei
network_id: 3
}
The amount of gas required will be the same but the gas price will be very different.
Check services such as for the current gas prices:
You should calculate what the cost of deploying your contract will be. Depending on your contract and network congestion this could be in the region of $500-$1500
Thank you. I got the gasPrice part. Regarding the gas: value in the truffle-config.js file, I saw that my contract uses 3228723 gas when I deployed it on ropsten, should I then change the gas value in the config file to also 3228723 when I deploy to mainner? Or do I need to increase that?
It looks ok, though I would test with a dry run in Truffle.
Network congestion has increased the gas price since you posted this so you may need some buffer. You should calculate how much this will be to deploy prior to deploying.
Truffle also deploys a Migrations contract when you use migrations.
Thanks. Yup I included the migrations contract in the gas used total above. Would you know whats the ideal time for deployment where gas cost would be cheaper?