Partial signing raw transactions

(Danny Thorpe) #1

Is there a recommended process to add signatures to a partially signed multisig transaction received in raw bitcoind hex format?

var tx = new Transaction(hexTx);
tx.sign(myPrivKey, sighash);

This falls over because the inputs don’t have output objects when the transaction is constructed from bitcoind hex format.


This fails because the input objects on the transaction are instances of the Input base class (which does not implement .getSignatures()) instead of something more appropriate like Multiscriphashinput.

Surfing around in the bitcore code a bit I can guess that if the transaction object were built by Bitcore and/or serialized using toObject() or toJson(), the output properties of the transaction inputs would probably be filled in and carried across json serialization. However, I don’t have the luxury of working with Bitcore specific data formats. I have to work with a bitcoind hex transaction.

So, given a partially-signed multisig transaction received from a third party serialized in bitcoind hex format, how do I add my signatures to the appropriate inputs using Bitcore?


(esteban) #2

As I understand it, bitcoind uses OP_0 for incomplete transactions whenever a signature is missing, so these scripts look like: OP_0 OP_0 OP_0 2-of-3-redeemScript for what we call a multisigscripthashinput (sorry about the long name). Spawned an issue to serialize and deserialize these correctly:

Meanwhile, solutions will look ugly. I can’t think of an quick and clean solution for this. Do you need a timeframe for the likely time of implementation?

(Gabriel Montes) #3

Hi guys! I’m facing the same scenario. Any additional input on how to properly deserialize the hex string and apply more signatures?