Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Estimate gas failing - need to have FROM - UnhandledPromiseRejectionWarning: Error: Returned error: execution reverted #5

Open
stefek99 opened this issue Jan 27, 2021 · 1 comment

Comments

@stefek99
Copy link

I'm using this as a base: https://blog.infura.io/deploying-smart-contracts-managing-transactions-ethereum/?utm_source=social&utm_medium=facebook&utm_campaign=Tutorials

gas: await tx.estimateGas(),

From the docs: https://web3js.readthedocs.io/en/v1.3.1/web3-eth-contract.html#methods-mymethod-estimategas

Will call to estimate the gas a method execution will take when executed in the EVM. The estimation can differ from the actual gas used when later sending a transaction, as the state of the smart contract can be different at that time. Note: You must specify a from address otherwise you may experience odd behavior.

(emphasis mine)

In my code I had to add {from: process.env.ETH_ADDRESS } and now it works.

@wayudi208012
Copy link

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants