Multisig transactions with 2 addresses from the same node

+2 votes
Hi,

When I try to send a transaction from a 2 of 2 multisig address that contains address a and b (that both belong to the same node), after only address a signs, it says the multisig transaction is complete. Does anyone have an idea why this is happening?
asked Jun 30, 2017 by anonymous

1 Answer

0 votes
 
Best answer

How are you trying to ensure that only address a signs? Generally if you pass a raw transaction to signrawtransaction, the node will sign it as much as possible. If you don't want this to happen you need to explicitly pass in the private keys you want to use (these can be extracted from the wallet using dumpprivkey).

answered Jun 30, 2017 by MultiChain
thanks for this - when I use createrawsendfrom, is there an option to do that as well?
No, if you pass the sign or send parameter, all possible signatures will be added. So you'd need to break it up into more stages.
how would i break it up into more stages? do you know which api commands i would use?
createrawsendfrom (without sign/send) -> signrawtransaction (with one private key) -> signrawtransaction (with the other private key) -> sendrawtransaction
thanks. if a tx-hex doesn't change after signing using this process, what does that mean? also, how can i see the status of a multisig transaction, including who has signed/who hasn't? (sorry for so many questions)
If the tx-hex hasn't changed, nothing happened. You can use decoderawtransaction to check its status at any point.
do you know any reason why the tx-hex wouldn't change?
If you post a transcript of your steps we can try to help.
Address 1 (Belongs to node 1): 1LSaHnQZTrnmUp8wQPLv1ycrtSbLGznRgNVPWk

Address 2 (Belongs to node 1):
14ykRF1HpFefxQLpeTNhXzvxV6SNgEswf3VNnH

Address 1 priv-key:
V9RvzQJjCjYic6tuWs5p9tTSwgxSucFXujQ6Bj4vGJrGrEtsgQYmn1nv

Address 2 priv-key:
VBkfxqwW6zSNMVkBx44N82PQAAeWZ4X5EV8Xznth3EEVi5tWexJTZAox

2 of 2 Multisig address: 44Xny1HjjRxnVninYFzfE4Z8hBAATx23XfMWqQ
(created by passing in 2 and pubkeys of address 1 and 2)

1. createrawsendfrom 44Xny1HjjRxnVninYFzfE4Z8hBAATx23XfMWqQ '{}' '[{"for": "notifications", "key": test, "data": 74657374}]'

returned 01000000015dbb3f6fc7b2765921b942a5129a1ca4f1df77621588aa92ce009cf586b56b360000000000ffffffff020000000000000000261473706b6554202bde7c2e1251f61e251cad10dfe2750873706b6b74657374756a0474657374000000000000000017a9142189b9ba89ef86be95cebe02b2a91c04436486378700000000


2. signrawtransaction 01000000015dbb3f6fc7b2765921b942a5129a1ca4f1df77621588aa92ce009cf586b56b360000000000ffffffff020000000000000000261473706b6554202bde7c2e1251f61e251cad10dfe2750873706b6b74657374756a0474657374000000000000000017a9142189b9ba89ef86be95cebe02b2a91c04436486378700000000 '[]' '["V9RvzQJjCjYic6tuWs5p9tTSwgxSucFXujQ6Bj4vGJrGrEtsgQYmn1nv"]'

returned
{
    "hex" : "01000000015dbb3f6fc7b2765921b942a5129a1ca4f1df77621588aa92ce009cf586b56b360000000000ffffffff020000000000000000261473706b6554202bde7c2e1251f61e251cad10dfe2750873706b6b74657374756a0474657374000000000000000017a9142189b9ba89ef86be95cebe02b2a91c04436486378700000000",
    "complete" : false
}


It looks like the hex returned is unchanged, and I can't seem to figure out why.

edit: Just as a note, when I signed the raw transaction on node 1 without trying to pass in the private key, the hex did change and the "complete" field returned was true.
Thanks. We have the answer, but it's a little complex.

In order to sign a transaction input which spends a multisig (pay-to-script-hash) output with manually provided private keys, you need to provide some extra information to signrawtransaction in the second parameter. Here's an example of the parameter you need to pass (with values to be replaced):

'[{"txid":"1c75e85549127769cfbf21dbfe7d2c12afc26c6c3537e3649e9a7dc24a642121","vout":0,"redeemScript":"52210295a58824e10a27e075705d19f9322de753da9e023bb3a2d5a34ae152c3bb65042103bfb47ad4b424780937435580fcbb505facbcdad3e6f8b76217c2daa46144b82152ae","scriptPubKey":"a914801c5e022242d156c74425aaa1325f4428282871473706b700600000000000000ffffffff2bb1585975"}]'

Set the value of txid and vout to those of the previous input being spent.

Set the scriptPubKey to the script of that previous input (obtainable from the scriptPubKey -> hex field of getrawtransaction with the previous txid, and verbose=1.

Set the redeemScript to the redeem script of the scripthash. You can obtain this from the "hex" field if you use getaddress or listaddresses with verbose=true, or validateaddress.

In the case where the multisig is actually in the wallet, the wallet already has all this information, so it shouldn't strictly be necessary, but that's how it is for now.
thanks:
for txid and vout, would i find that in the vin field when using getrawtransaction?

also, could you give me a little bit more detail on redeemScript? i can't seem to find it.
Yes, you can get the txin and vout from the vin of the new transaction.

The redeemScript is the script used to spend a multisig, and whose hash matches the scripthash in the output.
...