Bitcoinjs-lib: redeemScript.equals is not defined

Created on 13 Mar 2018  路  3Comments  路  Source: bitcoinjs/bitcoinjs-lib

I'm using bitcoinjs with browserify and babelify, and I'm getting strange errors when I try to import an unsigned transaction from its hex:

Error: redeemScript.equals is not a function
expandInput@http://localhost:8000/app.js:84056:12
[172]</TransactionBuilder.prototype.__addInputUnsafe@http://localhost:8000/app.js:84521:13
[172]</TransactionBuilder.fromTransaction/<@http://localhost:8000/app.js:84466:5
[172]</TransactionBuilder.fromTransaction@http://localhost:8000/app.js:84465:3

Going deeper in the bitcoinjs code, I found that the error arise here: https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/transaction_builder.js#L131
Inspecting the variable redeemScript I found that is an Uint8Array, which does not contains the 'equals' method. Am I missing something?

how to / question / docs

Most helpful comment

I just found the problem, was a babel replacing the safebuffer.Buffer with an Uint8Array. Sorry for that

All 3 comments

Can you provide the problematic code in question?
And can you provide the environment details?

It sounds like we won't be able to reproduce this in Node.

I just found the problem, was a babel replacing the safebuffer.Buffer with an Uint8Array. Sorry for that

Thanks for posting your problem and solution @dakk, no doubt this will help others too :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

askucher picture askucher  路  3Comments

silence-may picture silence-may  路  3Comments

coingeek picture coingeek  路  4Comments

itsMikeLowrey picture itsMikeLowrey  路  3Comments

tuyennvtb picture tuyennvtb  路  3Comments