Error: recovery id invalid
nikashitsa opened this issue ยท 2 comments
nikashitsa commented
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 commented
Does classic support eip1559 txs, which are default? if not, try using legacy
tx type
nikashitsa commented
Transaction above is legacy
.
const tx = new Transaction(raw, undefined, undefined, 'legacy');
// Same error
Error: recovery id invalid
...