Bitcoin Forum
May 07, 2024, 05:16:11 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Multisig address different on API and bitcoin-qt  (Read 1031 times)
camponez (OP)
Member
**
Offline Offline

Activity: 63
Merit: 10


View Profile
February 22, 2014, 02:46:54 PM
 #1

(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:XXXXXXXXXXXXXXX@127.0.0.1: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?

Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715102171
Hero Member
*
Offline Offline

Posts: 1715102171

View Profile Personal Message (Offline)

Ignore
1715102171
Reply with quote  #2

1715102171
Report to moderator
1715102171
Hero Member
*
Offline Offline

Posts: 1715102171

View Profile Personal Message (Offline)

Ignore
1715102171
Reply with quote  #2

1715102171
Report to moderator
1715102171
Hero Member
*
Offline Offline

Posts: 1715102171

View Profile Personal Message (Offline)

Ignore
1715102171
Reply with quote  #2

1715102171
Report to moderator
yakov
Newbie
*
Offline Offline

Activity: 40
Merit: 0


View Profile
February 22, 2014, 03:34:40 PM
 #2

The order of public keys matters

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

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

camponez (OP)
Member
**
Offline Offline

Activity: 63
Merit: 10


View Profile
February 22, 2014, 04:04:21 PM
 #3

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?
yakov
Newbie
*
Offline Offline

Activity: 40
Merit: 0


View Profile
February 22, 2014, 04:10:46 PM
 #4

Probably not. I suggest trying it to see.

Report back when you find out for sure.
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1025



View Profile
February 23, 2014, 12:26:12 PM
 #5

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.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
camponez (OP)
Member
**
Offline Offline

Activity: 63
Merit: 10


View Profile
February 23, 2014, 01:57:38 PM
 #6

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
*
Offline Offline

Activity: 1302
Merit: 1025



View Profile
February 23, 2014, 02:22:39 PM
 #7

You have extra stuff in your call.  It should be:

signrawtransaction <hex> <tx array> <key array>

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.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
camponez (OP)
Member
**
Offline Offline

Activity: 63
Merit: 10


View Profile
February 23, 2014, 02:29:58 PM
 #8

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
*
Offline Offline

Activity: 1302
Merit: 1025



View Profile
February 24, 2014, 03:28:24 AM
 #9

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,...]'

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
camponez (OP)
Member
**
Offline Offline

Activity: 63
Merit: 10


View Profile
February 24, 2014, 12:09:26 PM
 #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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!