0

So, I wrote a smart contract to create my own token. I deployed on Ropsten and it's all good. The next step was to deploy to mainnet, I know if it's just for testing it's not worth it but wanted to do it anyway. My first problem is that there doesn't seem to be a way to know in advance how much gas it will cost? I read in some places that I could look at the details in remix when I deploy using Javascript VM, and I saw this

gas              | 80000000 gas
transaction cost |  1325491 gas 
execution cost   |  1325491 gas 

And here I can see that only the transaction cost seems to be 2610 ETH? Is that an accurate estimation or those numbers don't reflect what it would cost me to deploy on mainnet?

1 Answer 1

1

You are mixing gas with Eth. gas is a unit of measuring computational complexity, used in transactions. Eth is the native asset used to pay for gas.

You can read details about gas calculations here: https://ethereum.org/en/developers/docs/gas/#post-london . From the document:

Calculating the total transaction fee works as follows: Gas units (limit) * (Base fee + Tip)

So if your transaction takes 1325491 gas, you multiply that value with the used (base fee + tip). Looking at https://ethgasstation.info/ , the base fee is currently 130 gwei and tip (priority fee) is around 10 gwei. So, if you submitted your transaction now, your gas price would be 130+10=140 gwei and the cost for the transaction is 140gwei * 1325491 = 185568740 gwei = 0,18556874 Eth.

2
  • that makes a lot more sense. I used a website that told me ETH based on Gas but probably was wrong. Also, I guess I would also need to add the "execution cost" on top of the transaction cost right? Is that data returned by remix a good estimate?
    – nelson687
    Nov 4, 2021 at 12:48
  • 1
    No, only the ` transaction cost` is relevant - the execution cost is included in that. ethereum.stackexchange.com/questions/5812/… Nov 4, 2021 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.