Author

Topic: Multisig address different on API and bitcoin-qt (Read 1057 times)

member
Activity: 63
Merit: 10
February 24, 2014, 07:09:26 AM
#10
You are passing your keys as two arrays, each with one anonymous element.  You need to combine them into a single array with two elements.

If you don't need the txin info:

signrawtransaction 'hex' '' '[key1,key2,...]'
Didnt work.

Code:
$ bitcoind -testnet signrawtransaction  '01000000013982927561cba1a320b0e6ee46f07738e0e799d0f2c61a5108754b08e49feeda0000000000ffffffff020084d7170000000017a914560b6741868b3b8ee443578f70d7622bb8b9d37e870046c323000000001976a91497885c4f568d1e23e082374825928cd3cc3a941c88ac00000000' '' '["cSbeRtDqgXVSDqWMkC8Drwrq81qwwbfF2L5apmivMBtPEu335Un8"]' 

error: Error parsing JSON:

I was passing just one priv key. I'd like to do a sign at a time.
kjj
legendary
Activity: 1302
Merit: 1026
You are passing your keys as two arrays, each with one anonymous element.  You need to combine them into a single array with two elements.

If you don't need the txin info:

signrawtransaction 'hex' '' '[key1,key2,...]'
member
Activity: 63
Merit: 10
The extra stuff I put was because of this error.

Code:
$ bitcoind -testnet signrawtransaction  01000000013982927561cba1a320b0e6ee46f07738e0e799d0f2c61a5108754b08e49feeda0000000000ffffffff020084d7170000000017a914560b6741868b3b8ee443578f70d7622bb8b9d37e870046c323000000001976a91497885c4f568d1e23e082374825928cd3cc3a941c88ac00000000   '["daee9fe4084b7508511ac6f2d099e7e03877f046eee6b020a3a1cb6175928239"]' '["cSbeRtDqgXVSDqWMkC8Drwrq81qwwbfF2L5apmivMBtPEu335Un8"]' 

error: {"code":-22,"message":"expected object with {\"txid'\",\"vout\",\"scriptPubKey\"}"}
kjj
legendary
Activity: 1302
Merit: 1026
You have extra stuff in your call.  It should be:

signrawtransaction

The arrays are used to fill in missing information needed to complete the signature, mostly for offline use.

If all of the transactions being redeemed by the transaction being signed are already in the block chain (as seen by the signing node), you can skip them.  Otherwise, you need to provide them.  If this is an offline (secret) transaction, you have them from when you created the secret transaction.  If the transaction isn't secret, but the signing computer is offline, your gateway needs to look them up and you need to include them in your signing package.

Always keep in mind that the tx array is filled with information about the inputs to the current transaction, not about the current transaction itself.
member
Activity: 63
Merit: 10
I'm having problems signing:

Code:
bitcoind -testnet signrawtransaction  01000000013982927561cba1a320b0e6ee46f07738e0e799d0f2c61a5108754b08e49feeda0000000000ffffffff020084d7170000000017a914560b6741868b3b8ee443578f70d7622bb8b9d37e870046c323000000001976a91497885c4f568d1e23e082374825928cd3cc3a941c88ac00000000  '[{"scriptPubKey": "76a914196d43432053d6e98276379e19fad949880309d988ac", "vout": 0, "txid": "daee9fe4084b7508511ac6f2d099e7e03877f046eee6b020a3a1cb6175928239"}]' '["cSbeRtDqgXVSDqWMkC8Drwrq81qwwbfF2L5apmivMBtPEu335Un8"]' '{"2N16Bm6jDE1FzLNALz7k6vaNTLt4h2A7663": 4, "muLBgX7Y9D3zQGeoXjWZ3dPowACxbTN8nd": 6}'

error: {"code":-22,"message":"Previous output scriptPubKey mismatch:\nOP_DUP OP_HASH160 f1a395809c29a31d49a36b76d2fc86718cca7abb OP_EQUALVERIFY OP_CHECKSIG\nvs:\nOP_DUP OP_HASH160 196d43432053d6e98276379e19fad949880309d9 OP_EQUALVERIFY OP_CHECKSIG"}


From where I get this ScriptPubKey? Why I need it?
kjj
legendary
Activity: 1302
Merit: 1026
When signing the transaction does the order matters? I mean, does the first key needs to be the first to sign?

Nope, the signing can be done in any order.
newbie
Activity: 40
Merit: 0
Probably not. I suggest trying it to see.

Report back when you find out for sure.
member
Activity: 63
Merit: 10
The order of public keys matters

Code:
./bitcoind -testnet createmultisig 2 '["0246137887433809d28ba48d08153f5461ced55703f27fd46dedb775a5f5fe8a86","0352cf6e2c4d36294a89fe520ec6f4fa29859e6f69b549b8eb4128b55f596923c6","028c82c09e3b893f1611cef20c86b399f27d9d76fe9c456df33a0f8319958689f7"]'

{
    "address" : "2N16Bm6jDE1FzLNALz7k6vaNTLt4h2A7663",
    "redeemScript" : "52210246137887433809d28ba48d08153f5461ced55703f27fd46dedb775a5f5fe8a86210352cf6 e2c4d36294a89fe520ec6f4fa29859e6f69b549b8eb4128b55f596923c621028c82c09e3b893f16 11cef20c86b399f27d9d76fe9c456df33a0f8319958689f753ae"
}


Oh!

When signing the transaction does the order matters? I mean, does the first key needs to be the first to sign?
newbie
Activity: 40
Merit: 0
The order of public keys matters

Code:
./bitcoind -testnet createmultisig 2 '["0246137887433809d28ba48d08153f5461ced55703f27fd46dedb775a5f5fe8a86","0352cf6e2c4d36294a89fe520ec6f4fa29859e6f69b549b8eb4128b55f596923c6","028c82c09e3b893f1611cef20c86b399f27d9d76fe9c456df33a0f8319958689f7"]'

{
    "address" : "2N16Bm6jDE1FzLNALz7k6vaNTLt4h2A7663",
    "redeemScript" : "52210246137887433809d28ba48d08153f5461ced55703f27fd46dedb775a5f5fe8a86210352cf6 e2c4d36294a89fe520ec6f4fa29859e6f69b549b8eb4128b55f596923c621028c82c09e3b893f16 11cef20c86b399f27d9d76fe9c456df33a0f8319958689f753ae"
}

member
Activity: 63
Merit: 10
(Everything was done using '-testnet')

I'm playing with multisig addresses and found something strange:

In the bitcoin-qt I did:
Code:
createmultisig 2 '["028c82c09e3b893f1611cef20c86b399f27d9d76fe9c456df33a0f8319958689f7","0246137887433809d28ba48d08153f5461ced55703f27fd46dedb775a5f5fe8a86","0352cf6e2c4d36294a89fe520ec6f4fa29859e6f69b549b8eb4128b55f596923c6"]'
With this output:
{
"address" : "2MyMdJW7GpkULivugRMNqrVuaoqFenc7ioS",
"redeemScript" : "5221028c82c09e3b893f1611cef20c86b399f27d9d76fe9c456df33a0f8319958689f7210246137 887433809d28ba48d08153f5461ced55703f27fd46dedb775a5f5fe8a86210352cf6e2c4d36294a 89fe520ec6f4fa29859e6f69b549b8eb4128b55f596923c653ae"
}

Then I wrote a python script:
Code:
access = ServiceProxy("http://ZZZZZZZZZZ:[email protected]:8332")

ladds = {'mj1zkN24ADDKPD8yCCXvBYtpJHz8FqJ7DC':'028c82c09e3b893f1611cef20c86b399f27d9d76fe9c456df33a0f8319958689f7',
            'mhqQ5ZLETv3y3wgXYcLPY9W7ssziscFKsh':'0246137887433809d28ba48d08153f5461ced55703f27fd46dedb775a5f5fe8a86',
            'muLBgX7Y9D3zQGeoXjWZ3dPowACxbTN8nd':'0352cf6e2c4d36294a89fe520ec6f4fa29859e6f69b549b8eb4128b55f596923c6' }

pubkey = list(ladds)

multisig = access.createmultisig(2, pubkey)

print 'multisig: ',multisig['address']


the output:

multisig:  2N16Bm6jDE1FzLNALz7k6vaNTLt4h2A7663


Those addresses would have been the same?! What am I missing here?

Jump to: