Error: RangeError: value out of range when decoding raw tx
See original GitHub issueHi, I ran into issues when decoding some raw transactions, some will decode, some will not.
const bitcoinjs = require('bitcoinjs-lib')
const network = {
messagePrefix: '\x18Monaize Signed Message:\n',
bip32: {
public: 0x0488B21E,
private: 0x0488ADE4
},
pubKeyHash: 0x3c,
scriptHash: 0x55,
wif: 0xbc
}
let txValid =
"0100000001605050d7b78352da4332f5f2798e33b3997a7ae296ff8369edcf1eb52c9ad4d6010000006b483045022100e950b4720dd6d4be823a02a70564a80b0174385e9c5242cb57f9ec1d6ac65ee002205b56ef3323d538b2aaa6579b8a17f3d1f5e6164e6b03873d03e608b2bdf848ba012103668e3368c9fb67d8fc808a5fe74d5a8d21b6eed726838122d5f7716fb3328998ffffffff0200e1f505000000001976a91486c7b9ada0107304932a603f19a57a4478d1a7e988ac00382e1b1f0000001976a91473122bcec852f394e51496e39fca5111c3d7ae5688ac00000000"
let txNonValid =
"0100000001d6987930e07b72810a4be2b92f057b242e9d503452bee254e39c87e57fc3b4b6000000006b483045022100ce1ca28aa02102fce86c712a4dda983b3285cd78ece7108d4a4865cfaa4199ba022035996623faafef94da3ba4de1def041ac21950e82c9fa8d4ab32bc8f70502046012102300d29dc3ffc0e0b28abc64c04458bb57180a7c280fc65108460e16878d86c19feffffff021ab4ec6cc6b858001976a91438cbde195a5f6f6d3863e9dd33643fbf8d2d315f88acc054d228950000001976a91473122bcec852f394e51496e39fca5111c3d7ae5688acd2e8935a"
let decodedTx = bitcoinjs.Transaction.fromHex(txValid, network)
console.log(decodedTx)
let decodedTxNonValid = bitcoinjs.Transaction.fromHex(txNonValid, network)
console.log(decodedTxNonValid);
On the second tx I get this :
/home/xx/src/testbjs/node_modules/bitcoinjs-lib/src/bufferutils.js:8
if (value > max) throw new Error('RangeError: value out of range')
^
Error: RangeError: value out of range
at verifuint (/home/xx/src/testbjs/node_modules/bitcoinjs-lib/src/bufferutils.js:8:26)
at Object.readUInt64LE (/home/xx/src/testbjs/node_modules/bitcoinjs-lib/src/bufferutils.js:17:3)
at readUInt64 (/home/xx/src/testbjs/node_modules/bitcoinjs-lib/src/transaction.js:69:25)
at Function.Transaction.fromBuffer (/home/xx/src/testbjs/node_modules/bitcoinjs-lib/src/transaction.js:118:14)
at Function.Transaction.fromHex (/home/xx/src/testbjs/node_modules/bitcoinjs-lib/src/transaction.js:141:22)
at Object.<anonymous> (/home/xxx/src/testbjs/index.js:23:47)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:20 (11 by maintainers)
Top Results From Across the Web
node.js - RangeError [ERR_OUT_OF_RANGE]: The value of ...
This appears to be a bug in Sequelize. Doing too many insertions or updates asynchronously causes this to happen. I don't know specifically ......
Read more >TO_TIMESTAMP function - Amazon Redshift
An optional Boolean value that specifies whether an error is returned if an input timestamp value is out of range. When is_strict is...
Read more >Code Duplication - blocktrail/blocktrail-sdk-nodejs
sendRawTransaction=function(e,t){return this.client.post("/send-raw-tx",null,e,t)} ... new Error("RangeError: value out of range");if(Math.floor(e)!
Read more >types package - github.com/tharsis/ethermint/rpc/types - Go Packages
RawTxToEthTx returns a evm MsgEthereum transaction from raw tx bytes. ... the given argument isn't a known strings - an out of range...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You can split change if you want.
hehe
oh yeah! I forgot, javascript is special! 😄