Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signTransaction fails with Method eth_chainId not supported. (beta51) #2610

Closed
szerintedmi opened this issue Mar 29, 2019 · 7 comments
Closed

Comments

@szerintedmi
Copy link

szerintedmi commented Mar 29, 2019

Description

signTransaction fails with Method eth_chainId not supported. error when I don't provide chainId in tx data. It used to work in earlier beta releases.

It seems the defaults are not passed through because when I provide chainId in the tx data then sign complains about the gas being too low.

It's a regression, it works fine in beta36.

Expected behavior

This should work without passing chainId or gas (with defaultGas)

const txToSign = {
  from: accounts[0],
  to: contractAddress
  data: encodedABI
};

const signedTx = await web3.eth.accounts.signTransaction(txToSign, Private key);

Actual behavior

the code above throws:
Method eth_chainId not supported.
if I include chainId then I receive:
Error: TransactionSigner Error: gas limit is too low. Need at least 53464

Steps to reproduce the behavior

Error Logs

When I don't provide chainId:

Error: Method eth_chainId not supported.\n    at u.handleRequest (/Users/petro/ether/web3js_integration_tests/node_modules/ganache-cli/build/ganache-core.node.cli.js:52:377936)\n    at t (/Users/petro/ether/web3js_integration_tests/node_modules/ganache-cli/build/ganache-core.node.cli.js:52:241567)\n    at a.handleRequest (/Users/petro/ether/web3js_integration_tests/node_modules/ganache-cli/build/ganache-core.node.cli.js:52:376923)\n    at t (/Users/petro/ether/web3js_integration_tests/node_modules/ganache-cli/build/ganache-core.node.cli.js:52:241567)\n    at s.f.handleRequest (/Users/petro/ether/web3js_integration_tests/node_modules/ganache-cli/build/ganache-core.node.cli.js:52:370053)\n    at s.handleRequest (/Users/petro/ether/web3js_integration_tests/node_modules/ganache-cli/build/ganache-core.node.cli.js:52:367879)\n    at t (/Users/petro/ether/web3js_integration_tests/node_modules/ganache-cli/build/ganache-core.node.cli.js:52:241567)\n    at c.handleRequest (/Users/petro/ether/web3js_integration_tests/node_modules/ganache-cli/build/ganache-core.node.cli.js:52:375937)\n    at t (/Users/petro/ether/web3js_integration_tests/node_modules/ganache-cli/build/ganache-core.node.cli.js:52:241567)\n    at a.handleRequest (/Users/petro/ether/web3js_integration_tests/node_modules/ganache-cli/build/ganache-core.node.cli.js:52:375384)\n    at t (/Users/petro/ether/web3js_integration_tests/node_modules/ganache-cli/build/ganache-core.node.cli.js:52:241567)\n    at d._handleAsync (/Users/petro/ether/web3js_integration_tests/node_modules/ganache-cli/build/ganache-core.node.cli.js:52:241603)\n    at Timeout._onTimeout (/Users/petro/ether/web3js_integration_tests/node_modules/ganache-cli/build/ganache-core.node.cli.js:52:241028)\n    at ontimeout (timers.js:436:11)\n    at tryOnTimeout (timers.js:300:5)\n    at listOnTimeout (timers.js:263:5)\n    at Timer.processTimers (timers.js:223:10)

When I provide chainId but not gas:

Error: TransactionSigner Error: gas limit is too low. Need at least 21464
    at _callee$ (/Users/petro/ether/web3js_integration_tests/node_modules/web3-eth/dist/web3-eth.cjs.js:65:23)
    at tryCatch (/Users/petro/ether/web3js_integration_tests/node_modules/regenerator-runtime/runtime.js:45:40)
    at Generator.invoke [as _invoke] (/Users/petro/ether/web3js_integration_tests/node_modules/regenerator-runtime/runtime.js:271:22)
    at Generator.prototype.(anonymous function) [as next] (/Users/petro/ether/web3js_integration_tests/node_modules/regenerator-runtime/runtime.js:97:21)
    at asyncGeneratorStep (/Users/petro/ether/web3js_integration_tests/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
    at _next (/Users/petro/ether/web3js_integration_tests/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
    at /Users/petro/ether/web3js_integration_tests/node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7
    at new Promise (<anonymous>)
    at TransactionSigner.<anonymous> (/Users/petro/ether/web3js_integration_tests/node_modules/@babel/runtime/helpers/asyncToGenerator.js:21:12)
    at TransactionSigner.sign (/Users/petro/ether/web3js_integration_tests/node_modules/web3-eth/dist/web3-eth.cjs.js:84:22)
    at Proxy._callee$ (/Users/petro/ether/web3js_integration_tests/node_modules/web3-eth-accounts/dist/web3-eth-accounts.cjs.js:402:47)
    at tryCatch (/Users/petro/ether/web3js_integration_tests/node_modules/regenerator-runtime/runtime.js:45:40)
    at Generator.invoke [as _invoke] (/Users/petro/ether/web3js_integration_tests/node_modules/regenerator-runtime/runtime.js:271:22)
    at Generator.prototype.(anonymous function) [as next] (/Users/petro/ether/web3js_integration_tests/node_modules/regenerator-runtime/runtime.js:97:21)
    at asyncGeneratorStep (/Users/petro/ether/web3js_integration_tests/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
    at _next (/Users/petro/ether/web3js_integration_tests/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Gists

https://github.com/Augmint/web3js_integration_tests/blob/master/test/signTransaction.js

Versions

  • web3.js: beta51
  • nodejs: 10.15.3
  • browser: N/A
  • ethereum node: ganache-cli v.6.4.1
@nivida
Copy link
Contributor

nivida commented Mar 29, 2019

This isn't an issue of Web3.js and there is already an open issue in the ganache repository: trufflesuite/ganache#339.

@nivida nivida closed this as completed Mar 29, 2019
@barakman
Copy link
Contributor

barakman commented Apr 14, 2019

@nivida :
Since this issue doesn't take place on earlier versions of Web3.js (e.g., beta34), I believe that this actually IS a Web3.js issue to a certain extent.

@lucashenning
Copy link

Any update on this? This is still an issue in web3 1.0.0-beta.55 and Ganache 2.0.2-beta.0 (2.0.2-beta.0.648).

@robrobbins
Copy link
Contributor

robrobbins commented Jul 9, 2019

Why is this closed? I am receiving this error and I don't even use Truffle

@prographo
Copy link

const chainId = await web3.eth.net.getId();

But probably the implementation should determine this when the provider is set; I think it's always a 1:1 relationship.

@chanhosuh
Copy link

@prographo according to this, it is not 1-1, even empirically: https://medium.com/@pedrouid/chainid-vs-networkid-how-do-they-differ-on-ethereum-eec2ed41635b

@susantimilsina
Copy link

Can anyone help me here: My system versions are:
Ganache CLI v6.12.2
Node v21.6.2
I got this error
{'message': 'Method eth_feeHistory not supported.', 'code': -32000, 'data': {'stack': 'Error: Method eth_feeHistory not supported.\n at p.handleRequest

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

No branches or pull requests

8 participants