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

Invalid chainId used to sign transactions #2378

Closed
gabmontes opened this issue Feb 15, 2019 · 1 comment
Closed

Invalid chainId used to sign transactions #2378

gabmontes opened this issue Feb 15, 2019 · 1 comment
Labels
Bug Addressing a bug

Comments

@gabmontes
Copy link
Contributor

gabmontes commented Feb 15, 2019

Expected behavior

When signing transactions in Ethereum Classic (might be applicable to other chains as well), the signing logic in the accounts package shall use the proper chainId (i.e. 61/62) if it is not specified in the transaction object by calling eth_chainId RPC.

Actual behavior

In the above mentioned case, the chainId value is actually retrieved using the net_version RPC call, which does return an incorrect value (prior EIP-155).

Steps to reproduce the behavior

  1. Connect web3 to an Ethereum Classic node.
  2. Create a wallet/account so allow web3 to sign the txs.
  3. Send tx without specifying the chain ID.
  4. Check the transaction was not created using a chainId value 61/62.

Error Logs

N/A

Versions

Web3.js@1.0.0-beta.37

Related to #1644.

A quick fix for beta.37 and previous versions is to apply this patch:

--- a/node_modules/web3-eth-accounts/src/index.js
+++ b/node_modules/web3-eth-accounts/src/index.js
@@ -69,7 +69,7 @@ var Accounts = function Accounts() {
     var _ethereumCall = [
         new Method({
             name: 'getId',
-            call: 'net_version',
+            call: 'eth_chainId',
             params: 0,
             outputFormatter: utils.hexToNumber
         }),
gabmontes added a commit to autonomoussoftware/metronome-wallet-core that referenced this issue Feb 15, 2019
@nivida
Copy link
Contributor

nivida commented Feb 18, 2019

Will check and fix this in the current working branch (#2367)

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

No branches or pull requests

2 participants