Closed LiuZhongHaoCN closed 2 years ago
From the logs you provided it looks like you do not have enough funds for your second migrations (2_deploying_contracts.js). The total cost
is 0.36...
and your balance
is 0.12...
. Try using an account with a higher balance.
Yes, you are right, but I think there is a bug in ruffle. The total cost of deploying is 0.37... and my acount has about 0.5125 to deploy the contract. The balance shows in log, I think is the remain value which has cost the gas. As we can see, when the simulation finished, the balance has 0.125... and the simulation shuld successes. However, why the tuffle compares the remain balance with the total cost again? Obviously, It will return an error, which is nonsense.
If you think there is a bug, could you please provide a repo and specific steps to reproduce this error? Are you deploying from the same account? If you could provide the repo and steps it would help me in troubleshooting this.
Emmm, it may not a bug. Yesterday, I used the MetaMask to mint an NFT, I also meet the funds is not enough. So, I have a question. Is there a security strategy in Ethereum that if we want to make a transaction, we must satisfy the funds > 2 * costs and the transaction will be executed.
It seems like you are basically asking for a strategy for very accurately calculating gas costs? I'm not too much of an expert on this kind of thing but maybe someone else might have some suggestions here?
Currently on mainnet it is impossible to predict the cost of a transaction because the base fee changes per block. Your best bet right now is to get a crude estimate of what it will all cost and pad your account, sorry :( Closing for issue maintenance!
Migrations dry-run (simulation)
1_initial_migration.js
Deploying 'Migrations'
2_deploy_contracts.js
Deploying '***'
Error: sender doesn't have enough funds to send tx. The upfront cost is: 371000000000000000 and the sender's account only has: 125708628371760148
According to the simulation result, we can see I have enough balance to deploy my contract on mainnet, why the tuffle compares the upfront cost with the balance that has subtracted the upfront cost and return the error