5

I'm having troubles when estimating the gas to call to one of the methods of my contract deployed in kaleido.

I've successfully deployed the contract through Remix. Also from Remix I can call all my methods and they are working ok. From web3js I've instantiated it, and I can check the balance of my accounts from within web3js (1.0.0-beta.47), but when estimating the gas to call one of the methods of my contract I am getting the error "The method eth_chainId does not exist/is not available".

The code:

const provider = new Web3.providers.HttpProvider("https://<USER>:<PASS>@<NODE RPC ENDPOINT>");
const web3 = new Web3(provider);
const deploy = web3.eth.accounts.privateKeyToAccount(<ACCOUNT PRIVATE KEY>);
const contract = new web3.eth.Contract(contractAbi, contractAddress, { gasPrice: 1, gas: 4500000 });
var estimatedGas = await contract.methods.myMethod().estimateGas({ from: deploy.address });

The error:

Error: Node error: {"code":-32601,"message":"The method eth_chainId does not exist/is not available"}

Any idea what's is wrong?

1
  • 2
    Its really annoying that web3js beta team is not able to come up with some more or less stable version. Only short term hacked releases and breakage of otherwise existing stuff. Its called beta for a reason, but srsly... web developers should not build blockchains.
    – mschmoock
    Mar 6, 2019 at 10:59

3 Answers 3

1

It is a bug (or a missing feature, I'm not sure) in Ganache. That issue is tracked here: https://github.com/trufflesuite/ganache-core/issues/339

Until that is resolved, you need to downgrade all the way back to beta.38

0

I've checked with the kaleido support and it seems you have to use web3js 1.0.0-beta.38 to make it work.

1
  • I got beta-38 working and not reporting the error, however I had to install @babel/run-time which causes other errors
    – Kevin
    Mar 12, 2019 at 5:43
0

I use web3js 1.0.0-beta.36 to solve this error

Your Answer

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

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