web3.eth.estimateGas throws Error
Closed this issue · 2 comments
Code snippet for web3
creation is as follows:
web3 = createAlchemyWeb3('https://eth-goerli.alchemyapi.io/v2/-Dm....your...key')
Error is thrown from the estimateGas
call as follows:
web3.eth.estimateGas({ data, to, from, value })
Error is:
Node error: {"code":-32000,"message":"invalid opcode: opcode 0xdb not defined"}
at Function.validate (web3-providers.umd.js:112)
at CustomProvider._callee$ (web3-providers.umd.js:1157)
at tryCatch (runtime.js:63)
at Generator.invoke [as _invoke] (runtime.js:293)
at Generator.next (runtime.js:118)
at asyncGeneratorStep (asyncToGenerator.js:3)
at _next (asyncToGenerator.js:25)
Version:
"@alch/alchemy-web3": "^0.1.18"
This kind of error does not happen when using the standard web3
with the same code and environment (browser with Metamask)
I've self found out the crash root cause that is because the input arg of to
is accidentally NULL
.
This happened only for when using Alchemy web3 version 0.1.18
which is based on a very old version of web3.js
of 1.0.0-beta.55
. I don't know why Alchemy has grabbed this obsolete version despite the latest release is just several months ago.
Indeed, with the above version combination, the contract address retrieval via contract instance is always returned NULL
. Code snippet is as follows:
someContractInstance._address
Hi, so sorry that we are just getting to this issue now! We have since updated our dependencies and this should no longer be an issue.