question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RedeemScript not supported...

See original GitHub issue

Hello,

I tried to create (and broadcast via 3PBP) a Transaction with a SegWit P2SH(P2WPKH) input, followed exactly the example: https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/transactions.js#L151

However I kept getting the error:

if (!extracted) throw new Error('RedeemScript not supported "' + bscript.toASM(redeemScript) + '"')
Error: RedeemScript not supported "OP_0 751e76e8199196d454941c45d1b3a323f1433bd6"

Here’s my code:

var bitcoin = require('bitcoinjs-lib');
var testnet = bitcoin.networks.testnet

var keyPair = bitcoin.ECPair.fromWIF('cMahea7zqjxrtgAbB7LSGbcQUr1uX1ojuat9jZodMN87JcbXMTcA', testnet)
var pubKey = keyPair.getPublicKeyBuffer()
var pubKeyHash = bitcoin.crypto.hash160(pubKey)

var redeemScript = bitcoin.script.witnessPubKeyHashOutput(pubKeyHash)
var redeemScriptHash = bitcoin.crypto.hash160(redeemScript)

var scriptPubKey = bitcoin.script.scriptHashOutput(redeemScriptHash)
var address = bitcoin.address.fromOutputScript(scriptPubKey, testnet)
console.log(address);

var txb = new bitcoin.TransactionBuilder(testnet)
txb.addInput('d7291bd8b60c1d9ee14b0f09ac2860c91fe1040824206f53156bda34dd3b563e', 1)
txb.addOutput(address, 450000)
txb.sign(0, keyPair, redeemScript, null, 500000)

var tx = txb.build()

Am I missing something?

Thank you.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
hoangancommented, Sep 17, 2017

@dcousens Thanks, just did a clean up and updated newest version. By some reasons, my machine kept downloading the old version.

0reactions
dcousenscommented, Sep 17, 2017

My bet is v2.3.0, in which case, @hoangan I’d recommend upgrading as several changes and fixes have been added to TransactionBuilder.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Importing redeemscript · Issue #227 · Bit-Wasp/bitcoin-php
Basically I already have the redeemscript and multisig address created with a transaction input. I was trying to figure out how to import...
Read more >
redeemScript/witnessScript does not match scriptPubKey for ...
I am trying to retrieve some money from my script which has been signed by three public keys. My final goal is.
Read more >
redeemScript does not correspond to witnessScript - Bitcointalk
I create a bash script to generate private and public key, and I will report only the part to create redeem script etc....
Read more >
missing information about redeem script and addresses using ...
Dear multichain team, I have the following question using multisignature in MC ver "2.0.1". ... something. Thanks for your support, Fabio.
Read more >
Redeem Script, RedeemScript - Bitcoin Glossary
Definition. A script similar in function to a pubkey script. One copy of it is hashed to create a P2SH address (used in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found