1

I'm trying to generate a 2-of-2 multisig address:

  • pubkey1 and privkey1 on coinb.in
  • pubkey2 and privkey2 a bitcoin core client
  • I use createmultisig 2 '''["<pubkey1>", "<pubkey2>']''' on the core to generate the 2-of-2 multisig address.

.

{
  "address": "38RmRDRp4YedPXdh9Vu82akPRtXwvsPeRp",
  "redeemScript": "5221020150ce6954f0cdcc2c5d57cf249f25eab0eed23e39549c4f06bcb42a37f308ce2102224aca2849ddad9c663c0bcfdac5ce3ca06f784ac8eca83404a4ea4ac61dbe7d52ae"
}

I transferred 0.00001BTC to that address in txid 20615db3dcda53ab1e780bb9f2c417c5ad2acfbd475d168b205caba3db401f1a and my goal is to spend this amount from the multisig address:

  • I created a raw transaction on the bitcoincore:

.

createrawtransaction '''[{ "txid": "20615db3dcda53ab1e780bb9f2c417c5ad2acfbd475d168b205caba3db401f1a", "vout": 1 }]''' '''{ "1BT8tmV9Exfrx7FUjNvLQaUBgpZJaHyXMT": 0.00000900  }'''
  • I attempt to sign this transaction on coinb.in with privkey2:

coinb.in signature

  • I attempt to sign the second transaction on the core:

.

signrawtransaction "01000000011a1f40dba3ab5c208b165d47bdcf2aadc517c4f2b90b781eab53dadcb35d6120010000006b483045022100d4367946074622b6e22a936adbded609fba5d2501c603b630d3e2edadcb5bcc402203ac6693fbf2ac7ac4d4234ef19be348b6511a0fcdf5991cb26ac2b695876534c0121020150ce6954f0cdcc2c5d57cf249f25eab0eed23e39549c4f06bcb42a37f308ceffffffff0184030000000000001976a91472a2a94468e42593656cc9803c7a48c1863fc3e588ac00000000" 
'''[
     {
       "txid": "20615db3dcda53ab1e780bb9f2c417c5ad2acfbd475d168b205caba3db401f1a", 
       "vout": 1, 
       "scriptPubKey": "a91449e688475c78033674b8a645f4339fe41366251587", 
       "redeemScript": "5221020150ce6954f0cdcc2c5d57cf249f25eab0eed23e39549c4f06bcb42a37f308ce2102224aca2849ddad9c663c0bcfdac5ce3ca06f784ac8eca83404a4ea4ac61dbe7d52ae"}
]'''
'''["privkey2"]'''

Output

{
  "hex": "01000000011a1f40dba3ab5c208b165d47bdcf2aadc517c4f2b90b781eab53dadcb35d6120010000009200473044022015ededd076573807b25a4e7facef5ad132683d54ffde8d28c1dbcab4be8e852e02204a063aec61cf6e1eee4825b9f19566a06f87db02913b283f9281a133127002030100475221020150ce6954f0cdcc2c5d57cf249f25eab0eed23e39549c4f06bcb42a37f308ce2102224aca2849ddad9c663c0bcfdac5ce3ca06f784ac8eca83404a4ea4ac61dbe7d52aeffffffff0184030000000000001976a91472a2a94468e42593656cc9803c7a48c1863fc3e588ac00000000",
  "complete": false,
  "errors": [
    {
      "txid": "20615db3dcda53ab1e780bb9f2c417c5ad2acfbd475d168b205caba3db401f1a",
      "vout": 1,
      "scriptSig": "00473044022015ededd076573807b25a4e7facef5ad132683d54ffde8d28c1dbcab4be8e852e02204a063aec61cf6e1eee4825b9f19566a06f87db02913b283f9281a133127002030100475221020150ce6954f0cdcc2c5d57cf249f25eab0eed23e39549c4f06bcb42a37f308ce2102224aca2849ddad9c663c0bcfdac5ce3ca06f784ac8eca83404a4ea4ac61dbe7d52ae",
      "sequence": 4294967295,
      "error": "Script evaluated without error but finished with a false/empty top stack element"
    }
  ]
}

What am I doing wrong? Unfortunately I can't specify the pubkeyscript or redeemscrit to coinb.in, so could this be the reason why the signatures are not validating?

Note: I can sign the transaction successfully on bitcoin core when I specify both private keys in the command.

  • Why can't you provide the redeemscript to coinb.in? On the create transaction tab you can paste in the redeemscript instead of an input address. – m1xolyd1an Jan 8 '17 at 17:36
  • Indeed I think that's the root of the issue .. Coinbin does not allow me to specify a redeem script while signing a transaction ... Note that when I sign the transaction on the core first and then do the second signature on coinbin it works !! – motatoes Jan 8 '17 at 18:05
0

Well, I managed to solve this issue by manually modifying the transaction in javascript before calling coinbin's sign method. I've filed an issue with details here. This is how I ended up solving the issue in Javascript (this is kind of a hack, I just specify the same redeemScript for each input, which works for my specific usecase):

var rawtx2 = "01000000021a1f40dba3ab5c208b165d47bdcf2aadc517c4f2b90b781eab53dadcb35d61200100000000ffffffff05ec447a886d8711db0d5f4cbf1f61956cf227c82c5594ee195bb179e86faa910100000000ffffffff0138c70000000000001976a91472a2a94468e42593656cc9803c7a48c1863fc3e588ac00000000";


(function partialSignMultisig(window) {
    var coinjs = window.coinjs;
    var wifkey = "<WIFKEYHERE>";
    var script = rawtx2;
    var redeemScript = "5221020150ce6954f0cdcc2c5d57cf249f25eab0eed23e39549c4f06bcb42a37f308ce2102224aca2849ddad9c663c0bcfdac5ce3ca06f784ac8eca83404a4ea4ac61dbe7d52ae";

    var tx = coinjs.transaction();
    var t = tx.deserialize(script);

        // Manually specify scripts for inputs ..
    for (var i = 0; i < t.ins.length; i++) {
        t.ins[i].script = coinjs.script(redeemScript);
    }

    var signed = t.sign(wifkey);
    console.log( signed );


})(window);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.