Bitcoin Forum
May 06, 2024, 01:41:10 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Help using Multisig transactions  (Read 3656 times)
Meni Rosenfeld (OP)
Donator
Legendary
*
expert
Offline Offline

Activity: 2058
Merit: 1054



View Profile WWW
August 08, 2013, 05:03:03 PM
 #1

I tried experimenting with Multisig and followed Gavin's example, running Bitcoin-qt v0.8.3 and using the debug console.

However, I could not get it to work.

I'm using the following 3 keys, all generated in my bitcoin-qt wallet:

privkey: L2JjrJNUJjLwLHcLShFsbJVt6KuWqE3svqMUrfwbNJXgssujVWgV
pubkey: 02fff1a3da4dbc93d10fba4791689411a17d8308770f9cf6ea5854358441df6bc2

privkey: L1HKChJArnfKpApV7Cz7HEw9c5YKHRr9BwWtFf6f8RYmnyDXrq87
pubkey: 02a06a164106420bcc36908700af4dccc727b1e834f7424f1627623523d6751d10

privkey: L1hbxmK8H4dkk2dyHpNEN7H7RvAhaJnQUH27cdC4yAtAjQ1TNkdA
pubkey: 037bac6d147cd915b74f51c0e839d5345d816b2ab70da0a862b5bef6ab6d7f1123

I created a multisig address:

Code:
createmultisig 2 '["02fff1a3da4dbc93d10fba4791689411a17d8308770f9cf6ea5854358441df6bc2","02a06a164106420bcc36908700af4dccc727b1e834f7424f1627623523d6751d10","037bac6d147cd915b74f51c0e839d5345d816b2ab70da0a862b5bef6ab6d7f1123"]'

{
"address" : "3P1TEdL5DJYeRTSxYsaR4onfjQyZrQ5oGL",
"redeemScript" : "522102fff1a3da4dbc93d10fba4791689411a17d8308770f9cf6ea5854358441df6bc22102a06a164106420bcc36908700af4dccc727b1e834f7424f1627623523d6751d1021037bac6d147cd915b74f51c0e839d5345d816b2ab70da0a862b5bef6ab6d7f112353ae"
}

Went on to fund it (with the GUI). Details of funding transaction (https://blockchain.info/tx/683e77cbac7356bab448a90a0f652ab68314c1b026833431cd56abaf40d6031b):
Code:
decoderawtransaction 0100000001d97502e9eee14adedc356a000c8e506d1e62e49242c7519281410d6cacde91d11d0000006b483045022100f4dfccaa5871a28f2843e0179142693963c24ead8b8e7238fca1fe989d56debd02201526d623fcb53b1c295116eee655b800c7dc8f29f32d7eed2fe4974c4c2ae2df012102095d1ffb1a31b9adceb15d006230b1987e34a6816680ac9e8917019a5445a360ffffffff0232082a00000000001976a91498070b4f2c6f333ed11396830c9932d84ef9e2c788ac40420f000000000017a914e9d7420b3e02e16089372cd9b9c77c58b3e133248700000000

{
"txid" : "683e77cbac7356bab448a90a0f652ab68314c1b026833431cd56abaf40d6031b",
"version" : 1,
"locktime" : 0,
"vin" : [
{
"txid" : "d191deac6c0d41819251c74292e4621e6d508e0c006a35dcde4ae1eee90275d9",
"vout" : 29,
"scriptSig" : {
"asm" : "3045022100f4dfccaa5871a28f2843e0179142693963c24ead8b8e7238fca1fe989d56debd02201526d623fcb53b1c295116eee655b800c7dc8f29f32d7eed2fe4974c4c2ae2df01 02095d1ffb1a31b9adceb15d006230b1987e34a6816680ac9e8917019a5445a360",
"hex" : "483045022100f4dfccaa5871a28f2843e0179142693963c24ead8b8e7238fca1fe989d56debd02201526d623fcb53b1c295116eee655b800c7dc8f29f32d7eed2fe4974c4c2ae2df012102095d1ffb1a31b9adceb15d006230b1987e34a6816680ac9e8917019a5445a360"
},
"sequence" : 4294967295
}
],
"vout" : [
{
"value" : 0.02754610,
"n" : 0,
"scriptPubKey" : {
"asm" : "OP_DUP OP_HASH160 98070b4f2c6f333ed11396830c9932d84ef9e2c7 OP_EQUALVERIFY OP_CHECKSIG",
"hex" : "76a91498070b4f2c6f333ed11396830c9932d84ef9e2c788ac",
"reqSigs" : 1,
"type" : "pubkeyhash",
"addresses" : [
"1Err9baeyDLCqundwncXonx8ea1v1WmS5o"
]
}
},
{
"value" : 0.01000000,
"n" : 1,
"scriptPubKey" : {
"asm" : "OP_HASH160 e9d7420b3e02e16089372cd9b9c77c58b3e13324 OP_EQUAL",
"hex" : "a914e9d7420b3e02e16089372cd9b9c77c58b3e1332487",
"reqSigs" : 1,
"type" : "scripthash",
"addresses" : [
"3P1TEdL5DJYeRTSxYsaR4onfjQyZrQ5oGL"
]
}
}
]
}

And then tried to spend funds from the multisig address:
Code:
createrawtransaction '[{"txid":"683e77cbac7356bab448a90a0f652ab68314c1b026833431cd56abaf40d6031b","vout":1,"scriptPubKey":"a914e9d7420b3e02e16089372cd9b9c77c58b3e1332487","redeemscript":"522102fff1a3da4dbc93d10fba4791689411a17d8308770f9cf6ea5854358441df6bc22102a06a164106420bcc36908700af4dccc727b1e834f7424f1627623523d6751d1021037bac6d147cd915b74f51c0e839d5345d816b2ab70da0a862b5bef6ab6d7f112353ae"}]' '{"1BBsbEq8Q29JpQr4jygjPof7F7uphqyUCQ":0.0002}'

01000000011b03d640afab56cd31348326b0c11483b62a650f0aa948b4ba5673accb773e680000000000ffffffff01204e0000000000001976a9146fbfa5eb9cf96799b0ff7d25f9e3ea9e4323db5988ac00000000

signrawtransaction '01000000011b03d640afab56cd31348326b0c11483b62a650f0aa948b4ba5673accb773e680100000000ffffffff01204e0000000000001976a9146fbfa5eb9cf96799b0ff7d25f9e3ea9e4323db5988ac00000000' '[{"txid":"683e77cbac7356bab448a90a0f652ab68314c1b026833431cd56abaf40d6031b","vout":1,"scriptPubKey":"a914e9d7420b3e02e16089372cd9b9c77c58b3e1332487","redeemscript":"522102fff1a3da4dbc93d10fba4791689411a17d8308770f9cf6ea5854358441df6bc22102a06a164106420bcc36908700af4dccc727b1e834f7424f1627623523d6751d1021037bac6d147cd915b74f51c0e839d5345d816b2ab70da0a862b5bef6ab6d7f112353ae"}]' '["L2JjrJNUJjLwLHcLShFsbJVt6KuWqE3svqMUrfwbNJXgssujVWgV"]'

Missing redeemScript (code -3)
When trying to sign all I get is the error message "Missing redeemScript (code -3)", even though the redeemScript for the multisig address is included in the data. Same thing happens if I use a different privkey format.

If I don't specify privkeys at all, nothing happens, even though the needed keys are in the unlocked wallet:
Code:
signrawtransaction '01000000011b03d640afab56cd31348326b0c11483b62a650f0aa948b4ba5673accb773e680100000000ffffffff01204e0000000000001976a9146fbfa5eb9cf96799b0ff7d25f9e3ea9e4323db5988ac00000000' '[{"txid":"683e77cbac7356bab448a90a0f652ab68314c1b026833431cd56abaf40d6031b","vout":1,"scriptPubKey":"a914e9d7420b3e02e16089372cd9b9c77c58b3e1332487","redeemscript":"522102fff1a3da4dbc93d10fba4791689411a17d8308770f9cf6ea5854358441df6bc22102a06a164106420bcc36908700af4dccc727b1e834f7424f1627623523d6751d1021037bac6d147cd915b74f51c0e839d5345d816b2ab70da0a862b5bef6ab6d7f112353ae"}]'

{
"hex" : "01000000011b03d640afab56cd31348326b0c11483b62a650f0aa948b4ba5673accb773e680100000000ffffffff01204e0000000000001976a9146fbfa5eb9cf96799b0ff7d25f9e3ea9e4323db5988ac00000000",
"complete" : false
}

Any ideas what the problem is?

1EofoZNBhWQ3kxfKnvWkhtMns4AivZArhr   |   Who am I?   |   bitcoin-otc WoT
Bitcoil - Exchange bitcoins for ILS (thread)   |   Israel Bitcoin community homepage (thread)
Analysis of Bitcoin Pooled Mining Reward Systems (thread, summary)  |   PureMining - Infinite-term, deterministic mining bond
1715002870
Hero Member
*
Offline Offline

Posts: 1715002870

View Profile Personal Message (Offline)

Ignore
1715002870
Reply with quote  #2

1715002870
Report to moderator
1715002870
Hero Member
*
Offline Offline

Posts: 1715002870

View Profile Personal Message (Offline)

Ignore
1715002870
Reply with quote  #2

1715002870
Report to moderator
The grue lurks in the darkest places of the earth. Its favorite diet is adventurers, but its insatiable appetite is tempered by its fear of light. No grue has ever been seen by the light of day, and few have survived its fearsome jaws to tell the tale.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715002870
Hero Member
*
Offline Offline

Posts: 1715002870

View Profile Personal Message (Offline)

Ignore
1715002870
Reply with quote  #2

1715002870
Report to moderator
1715002870
Hero Member
*
Offline Offline

Posts: 1715002870

View Profile Personal Message (Offline)

Ignore
1715002870
Reply with quote  #2

1715002870
Report to moderator
1715002870
Hero Member
*
Offline Offline

Posts: 1715002870

View Profile Personal Message (Offline)

Ignore
1715002870
Reply with quote  #2

1715002870
Report to moderator
genjix
Legendary
*
expert
Offline Offline

Activity: 1232
Merit: 1072


View Profile
August 08, 2013, 05:55:06 PM
 #2

Maybe this is useful for you: https://bitcointalk.org/index.php?topic=270205.0 (sx: bash script for creating, redeeming and sending multisignature transaction)

Tutorial: http://sx.dyne.org/multisig.html
Meni Rosenfeld (OP)
Donator
Legendary
*
expert
Offline Offline

Activity: 2058
Merit: 1054



View Profile WWW
August 08, 2013, 06:20:04 PM
 #3

Maybe this is useful for you: https://bitcointalk.org/index.php?topic=270205.0 (sx: bash script for creating, redeeming and sending multisignature transaction)

Tutorial: http://sx.dyne.org/multisig.html
Thanks, however this is less intuitive for me than using the raw transaction API directly. (though a GUI would have been much preferred over either)

1EofoZNBhWQ3kxfKnvWkhtMns4AivZArhr   |   Who am I?   |   bitcoin-otc WoT
Bitcoil - Exchange bitcoins for ILS (thread)   |   Israel Bitcoin community homepage (thread)
Analysis of Bitcoin Pooled Mining Reward Systems (thread, summary)  |   PureMining - Infinite-term, deterministic mining bond
dserrano5
Legendary
*
Offline Offline

Activity: 1974
Merit: 1029



View Profile
August 08, 2013, 07:33:03 PM
 #4

Could it be that you're using "redeemscript" instead of "redeemScript", ie with a small "s" instead of a capital one?
Judson
Newbie
*
Offline Offline

Activity: 22
Merit: 0



View Profile
August 08, 2013, 07:54:02 PM
 #5

Yep, what dserrano5 said. The error should point you in the right direction: "Missing redeemScript".
Meni Rosenfeld (OP)
Donator
Legendary
*
expert
Offline Offline

Activity: 2058
Merit: 1054



View Profile WWW
August 08, 2013, 08:20:37 PM
 #6

Could it be that you're using "redeemscript" instead of "redeemScript", ie with a small "s" instead of a capital one?
Yep, what dserrano5 said. The error should point you in the right direction: "Missing redeemScript".
I'm an idiot. Thanks.

It pointed me at the right direction, but I didn't notice the case discrepancy, and since this datum was included in previous calls I assumed this kind of an error would have caused problems earlier.

1EofoZNBhWQ3kxfKnvWkhtMns4AivZArhr   |   Who am I?   |   bitcoin-otc WoT
Bitcoil - Exchange bitcoins for ILS (thread)   |   Israel Bitcoin community homepage (thread)
Analysis of Bitcoin Pooled Mining Reward Systems (thread, summary)  |   PureMining - Infinite-term, deterministic mining bond
cbeast
Donator
Legendary
*
Offline Offline

Activity: 1736
Merit: 1006

Let's talk governance, lipstick, and pigs.


View Profile
August 08, 2013, 11:17:10 PM
 #7

Thanks for posting this Meni. I was missing some points to understanding this from Gavin's example. I wish someone would write a step-by-step guide to creating m-of-n and nLockTime transactions.

Any significantly advanced cryptocurrency is indistinguishable from Ponzi Tulips.
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1024



View Profile
August 09, 2013, 04:03:25 AM
 #8

Could it be that you're using "redeemscript" instead of "redeemScript", ie with a small "s" instead of a capital one?
Yep, what dserrano5 said. The error should point you in the right direction: "Missing redeemScript".
I'm an idiot. Thanks.

It pointed me at the right direction, but I didn't notice the case discrepancy, and since this datum was included in previous calls I assumed this kind of an error would have caused problems earlier.

In case you were wondering why it didn't trigger on previous calls, the redeemScript isn't needed until signing.  You can stuff arbitrarily named members into that object without a problem.  Those functions only check to make sure they have the parts they need, they don't reject extra stuff, they just ignore it.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
cbeast
Donator
Legendary
*
Offline Offline

Activity: 1736
Merit: 1006

Let's talk governance, lipstick, and pigs.


View Profile
August 15, 2013, 02:59:52 AM
 #9

I followed Gavin's example. I created 3 vanity testnet addresses and took 1.5 test bitcoins from the faucet. I followed the example and created a 2 of 3 multisig with "value" : 0.01000000 sent from n18BfALhuJ4cXAtTDSMLSpiRjLvB6czXP8 to 2MuiZNuQR2vEmCq81XRTGRSHNETUGxEWR3C, but it sent the entire balance of 1.5 instead of 0.1. I have not yet imported the vanity addresses into a client to recover the test bitcoins. What happened to the change?

Any significantly advanced cryptocurrency is indistinguishable from Ponzi Tulips.
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1024



View Profile
August 15, 2013, 03:15:19 AM
 #10

I followed Gavin's example. I created 3 vanity testnet addresses and took 1.5 test bitcoins from the faucet. I followed the example and created a 2 of 3 multisig with "value" : 0.01000000 sent from n18BfALhuJ4cXAtTDSMLSpiRjLvB6czXP8 to 2MuiZNuQR2vEmCq81XRTGRSHNETUGxEWR3C, but it sent the entire balance of 1.5 instead of 0.1. I have not yet imported the vanity addresses into a client to recover the test bitcoins. What happened to the change?

Transactions are redeemed in full.  When using the raw API, you are responsible for making your own change.

In this case, your inputs total 1.5 and out outputs total 0.01.  The difference, 1.49, is the fee.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
cbeast
Donator
Legendary
*
Offline Offline

Activity: 1736
Merit: 1006

Let's talk governance, lipstick, and pigs.


View Profile
August 15, 2013, 03:27:16 AM
 #11

I followed Gavin's example. I created 3 vanity testnet addresses and took 1.5 test bitcoins from the faucet. I followed the example and created a 2 of 3 multisig with "value" : 0.01000000 sent from n18BfALhuJ4cXAtTDSMLSpiRjLvB6czXP8 to 2MuiZNuQR2vEmCq81XRTGRSHNETUGxEWR3C, but it sent the entire balance of 1.5 instead of 0.1. I have not yet imported the vanity addresses into a client to recover the test bitcoins. What happened to the change?

Transactions are redeemed in full.  When using the raw API, you are responsible for making your own change.

In this case, your inputs total 1.5 and out outputs total 0.01.  The difference, 1.49, is the fee.
This is why we use TESTNET!

Any significantly advanced cryptocurrency is indistinguishable from Ponzi Tulips.
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!