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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: recovery id invalid #16

Open
nikashitsa opened this issue Jun 7, 2023 · 2 comments
Open

Error: recovery id invalid #16

nikashitsa opened this issue Jun 7, 2023 · 2 comments

Comments

@nikashitsa
Copy link

Hi, great library 馃憤

I'm trying to use it with Ethereum Classic transactions which have chainId = 61, but I got error shown below.

// https://blockscout.com/etc/mainnet/tx/0x50d0c4d644045e37a459829e17cc463f88591f270dd9bb801da45604496098aa

const raw = '0xf86a14843b9aca00825208947fe9b4581d788e3efffb2b24b16c2bfd86d0c9368612309ce5400080819da0a687e91d2bcf2f9bd83ad2f85d378f730bd1630fba914fd21fe866160df15bb1a00532fc7319cf9325699a306874c602418cc58ce3041bf6f3becb1f1200883004';
const tx = new Transaction(raw);
console.log(tx.sender);

// Error

Error: recovery id invalid
      at Signature.recoverPublicKey (file:///myproject/node_modules/@noble/curves/esm/abstract/weierstrass.js:636:23)
      at Object.sigRecoverPub (file:///myproject/node_modules/micro-eth-signer/index.js:24:20)
      at Transaction.recoverSenderPublicKey (file:///myproject/node_modules/micro-eth-signer/index.js:420:21)
      at get sender [as sender] (file:///myproject/node_modules/micro-eth-signer/index.js:332:29)
      at Object.decodeRawTx (file:///myproject/app/lib/utils.js:37:18)
      at Context.<anonymous> (file:///myproject/test/lib/utils.test.js:86:24)
      at process.processImmediate (node:internal/timers:476:21)

My current fix is to set chainId manually

...
const tx = new Transaction(raw);
tx.raw.chainId = 61;
...

But I hope there could be more appropriate solution.
Please have a look!

@paulmillr
Copy link
Owner

Does classic support eip1559 txs, which are default? if not, try using legacy tx type

@nikashitsa
Copy link
Author

Transaction above is legacy.

const tx = new Transaction(raw, undefined, undefined, 'legacy');

// Same error
Error: recovery id invalid
...

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

2 participants