Pages:
Author

Topic: [Bounty] How-to Multi signature transactions (Read 13882 times)

legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
So when you see this it looks like only x/<=3 is standard, but in fact that only applies to a traditional, non-P2SH transaction. If you're doing P2SH, your script isn't TX_MULTISIG at the point where it's evaluating that. It's TX_SCRIPTHASH:
https://github.com/bitcoin/bitcoin/blob/0.9.0/src/script.cpp#L1414

Ah yes - I forgot all about P2SH stuff but that makes perfect sense to me now. Thanks.
sr. member
Activity: 352
Merit: 250
https://www.realitykeys.com
From what I read in the code only a 2 of 3 is *standard* currently.

The code's a bit tricky to follow when P2SH is involved because effectively script evaluation is happening twice, once when it checks that the script hash you're paying to matches the redeem script you've supplied, and once again when it actually runs the redeem script.

So when you see this it looks like only x/<=3 is standard, but in fact that only applies to a traditional, non-P2SH transaction. If you're doing P2SH, your script isn't TX_MULTISIG at the point where it's evaluating that. It's TX_SCRIPTHASH:
https://github.com/bitcoin/bitcoin/blob/0.9.0/src/script.cpp#L1414

To make the content of your P2SH script standard you just have to match one of the patterns in here:
https://github.com/bitcoin/bitcoin/blob/0.9.0/src/script.cpp#L1194

...which allows lots/lots, as long as you don't blow over the size limits.
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
From what I read in the code only a 2 of 3 is *standard* currently.
legendary
Activity: 1358
Merit: 1003
Ron Gross
https://bitcoin.stackexchange.com/questions/23893/what-are-the-limits-of-m-and-n-in-m-of-n-multisig-addresses

Quote
This method describes how to create a 2-of-3 multisig.

I heard that there was an inherent limit with the number of multisig parts, limiting them to 3.

Does the standard method described above of generating and spending multisig addresses work with more than 3 parts? What is the limit?
member
Activity: 63
Merit: 10
February 01, 2014, 01:57:29 PM
#37
Ok, I need to create multi signature transaction.. 2-of-3... What do I do?

Then create a 2-of-3 multisig address using addmultisigaddress; e.g.

Quote
bitcoind addmultisigaddress 2 '["044322868cb17d64dcc22185ae2d4493111d73244c3668f8ac79ecc79c0ba8d30a6756d0fa20157 709af3281cc721c7f53321a8cabda29b77900b7e4fe0174b114","..second pubkey..","..third pubkey.."]'
addmultisigaddress returns the multisignature address. Be a little careful, the public keys are raw hexadecimal and don't contain checksums like bitcoin addresses do.

You can then send funds into that 2-of-3 transaction using the normal sendtoaddress/sendmany RPC commands, or the GUI (or anything that's been updated to recognize multisig addresses).

That will create a multi signature transaction.


How do I get the hex pub key when I have just the wallet address and the "standard format" (1Kdjlj....)?
legendary
Activity: 1596
Merit: 1100
newbie
Activity: 15
Merit: 0
I need help on how to sign a message on bitcoin wallet 0.8.2. 

Thankyou.
newbie
Activity: 27
Merit: 0
The order of the keys is important.

Code:
bitcoind createrawtransaction '[{"txid":"12af315cdba24e9fd070a7579135d5ade458b5e71008b0421dcc6bb8a795b3cb","vout":0,"scriptPubKey":"a9143d0277df5a51360d0b2d68bbbbf7ed784601f30587","redeemScript":"5221024e43b94cfcdc4c8bd4502d37c8745538f19972434d1c72cb23e9ca0454103ef62103f74a2c52d87c81c589775510ff1d6743f4ab2529a7206cc28762f1559d716ada2102b55624dd872a0b3db3cf053dacd2960cfe909db3a5405353f95631cfc297dda253ae"}]' '{"1Bjaewgk3bXujiJUqLcrkk7aKSS1f9kUV3":0.0095}'

bitcoind signrawtransaction '0100000001cbb395a7b86bcc1d42b00810e7b558e4add5359157a770d09f4ea2db5c31af120000000000ffffffff01f07e0e00000000001976a91475bed242e9b2cf5b4d45ef9f052be369067eae6888ac00000000' '[{"txid":"12af315cdba24e9fd070a7579135d5ade458b5e71008b0421dcc6bb8a795b3cb","vout":0,"scriptPubKey":"a9143d0277df5a51360d0b2d68bbbbf7ed784601f30587","redeemScript":"5221024e43b94cfcdc4c8bd4502d37c8745538f19972434d1c72cb23e9ca0454103ef62103f74a2c52d87c81c589775510ff1d6743f4ab2529a7206cc28762f1559d716ada2102b55624dd872a0b3db3cf053dacd2960cfe909db3a5405353f95631cfc297dda253ae"}]' '["KxfZ1HKs7PLxXo7gmjJVU3Chvcu6fPKzBt61MEGnNZCpG4LC6kQH"]'

Looks like someone already sent it back to you.

Yeah I just figured this out, thanks to the folks on #bitcoin-dev

Btw there's a tool to make this really easy: https://github.com/CodeShark/CoinClasses
And here's how to use it: http://pastebin.com/W0zCLB6i


kjj
legendary
Activity: 1302
Merit: 1026
The order of the keys is important.

Code:
bitcoind createrawtransaction '[{"txid":"12af315cdba24e9fd070a7579135d5ade458b5e71008b0421dcc6bb8a795b3cb","vout":0,"scriptPubKey":"a9143d0277df5a51360d0b2d68bbbbf7ed784601f30587","redeemScript":"5221024e43b94cfcdc4c8bd4502d37c8745538f19972434d1c72cb23e9ca0454103ef62103f74a2c52d87c81c589775510ff1d6743f4ab2529a7206cc28762f1559d716ada2102b55624dd872a0b3db3cf053dacd2960cfe909db3a5405353f95631cfc297dda253ae"}]' '{"1Bjaewgk3bXujiJUqLcrkk7aKSS1f9kUV3":0.0095}'

bitcoind signrawtransaction '0100000001cbb395a7b86bcc1d42b00810e7b558e4add5359157a770d09f4ea2db5c31af120000000000ffffffff01f07e0e00000000001976a91475bed242e9b2cf5b4d45ef9f052be369067eae6888ac00000000' '[{"txid":"12af315cdba24e9fd070a7579135d5ade458b5e71008b0421dcc6bb8a795b3cb","vout":0,"scriptPubKey":"a9143d0277df5a51360d0b2d68bbbbf7ed784601f30587","redeemScript":"5221024e43b94cfcdc4c8bd4502d37c8745538f19972434d1c72cb23e9ca0454103ef62103f74a2c52d87c81c589775510ff1d6743f4ab2529a7206cc28762f1559d716ada2102b55624dd872a0b3db3cf053dacd2960cfe909db3a5405353f95631cfc297dda253ae"}]' '["KxfZ1HKs7PLxXo7gmjJVU3Chvcu6fPKzBt61MEGnNZCpG4LC6kQH"]'

Looks like someone already sent it back to you.
newbie
Activity: 27
Merit: 0
Sorry if I am being stupid but how do you "create" them?

Not stupid, just ignorant, which everyone of us were at some point.

Code:
bitcoind createmultisig

He wasn't asking how to create the multi-sig address, but how to create the scriptPubKey and redeemScript.

I've tried to follow Gavin's script to create a multi-sig address and spend the coins I sent to it, but I can't figure out how to create a transaction. Signing the raw transaction doesn't work for some reason. If someone could look at this and tell me what I did wrong, I'd be extremely grateful: http://pastebin.com/gkqF2Lh8 . Feel free to "steal" the 0.0095 BTC as long as you explain me how you created the transaction and what I did wrong.
legendary
Activity: 1974
Merit: 1029
Sorry if I am being stupid but how do you "create" them?

Not stupid, just ignorant, which everyone of us were at some point.

Code:
bitcoind createmultisig
newbie
Activity: 5
Merit: 0
I have 2 questions though:

1. Is it possible to verify for an external person that the transaction is a multi-signature transaction?

2. How do I get the sciptpubkey and the reedem key?

1.  No.  The can see that coins were sent to a P2SH address, which is the hash of a script, but they can't see what that script is until revealed.  It could be multisig, it could be pay-to-address, it could be something strange.  Of course, if you want people to see that it was multisig, you can publish the script through some other means, and people will be able to see that it really does hash to the P2SH address shown.

2.  You create them.  Or, if someone else is managing the address, they create them and then maybe give them to you.

Sorry if I am being stupid but how do you "create" them?
kjj
legendary
Activity: 1302
Merit: 1026
I have 2 questions though:

1. Is it possible to verify for an external person that the transaction is a multi-signature transaction?

2. How do I get the sciptpubkey and the reedem key?

1.  No.  The can see that coins were sent to a P2SH address, which is the hash of a script, but they can't see what that script is until revealed.  It could be multisig, it could be pay-to-address, it could be something strange.  Of course, if you want people to see that it was multisig, you can publish the script through some other means, and people will be able to see that it really does hash to the P2SH address shown.

2.  You create them.  Or, if someone else is managing the address, they create them and then maybe give them to you.
newbie
Activity: 5
Merit: 0
Hey

thanks for the help and the tutorial.
I have 2 questions though:

1. Is it possible to verify for an external person that the transaction is a multi-signature transaction?

2. How do I get the sciptpubkey and the reedem key?

Thanks
donator
Activity: 2772
Merit: 1019
That's all nice and dandy... but how can I construct a transaction to spend the money sent to that multisig address

Gavin's TwoOfThree.sh was enough for me to play with it. You're interested in the "Create the spend-from-multisig transaction" part.

Ah, this will greatly help. Thanks and also thanks Gavin for the script.
legendary
Activity: 1974
Merit: 1029
That's all nice and dandy... but how can I construct a transaction to spend the money sent to that multisig address

Gavin's TwoOfThree.sh was enough for me to play with it. You're interested in the "Create the spend-from-multisig transaction" part.
donator
Activity: 2772
Merit: 1019
Quote
$ ./bitcoind addmultisigaddress 2 '["0446fc07bc99bef8e7a875249657c65e1f1793fd0bf45e2c39d539b6f8fcd44676acc552ab886c1 1eb08f4a275e7bb7dc4fdaf9c4b2228856f168a69df7d216fbc","04df70eb0107ed08e1ddcd4b4d85d26bf8cca301f5c98fd15f5efef12ba4de72bfef7287f964e30 4207164c003029449740aaae2d6af1ff7ae3f6bb27f3012296c","046003581a3ff5bc3dedaa6da4834ce7bcd49d3f114ce15791f6b5de8b0cec81a46db2eb8cf84d2 db845854c57788c7283ab4040aeb3595bc5c68303a17fdde7c8"]'
Works in a Terminal on my Mac, returns:
Quote
3EffXJKyYB9zWh2dhx2hcccqBK8DGC7x2x
... which validates as:
Quote
Code:
$ ./bitcoind validateaddress 3EffXJKyYB9zWh2dhx2hcccqBK8DGC7x2x
{
    "isvalid" : true,
    "address" : "3EffXJKyYB9zWh2dhx2hcccqBK8DGC7x2x",
    "isscript" : true,
    "ismine" : false,
    "script" : "multisig",
    "addresses" : [
        "1HEmNY7Lpsqc81nP6JAymjGuuvdFLaqt1e",
        "1Gpuy32bmhtn3KL6dBDHdTHfMosXRH6xV4",
        "1AbU2FDgJRKejuY4e4XGYEfzo6uAGQ1Kyy"
    ],
    "sigsrequired" : 2,
    "account" : ""
}
I don't know enough about Windows CLI quoting rules to get ["...","...","..."] passed un-modified to bitcoind.exe.  


That's all nice and dandy... but how can I construct a transaction to spend the money sent to that multisig address and how can I have the owners of the privkeys add (or give me) their signatures to do so?
Jan
legendary
Activity: 1043
Merit: 1002
September 19, 2012, 06:14:36 AM
#24
When sending to a multisig address is it done in exactly the same way as with standard addresses?

Right now, in BitcoinSpinner, it complains about multisig addresses as it tries to validate that it is an address for the prodnet (0x00 prefix before Base58 encoding, 0x6F for testnet)
I guess the only thing I need to do is patch the code that validates the bitcoin address, so it also allows prefix 0x05 for the prodnet and 0xC4 for testnet.
legendary
Activity: 1596
Merit: 1100
September 17, 2012, 07:30:09 PM
#23
Is there currently a GUI that supports multisig? Is it a part of bitcoin-qt 0.7?

It is only RPC at this point.

legendary
Activity: 1596
Merit: 1100
September 17, 2012, 07:27:50 PM
#22
But even after that, there's a big hurdle for client developers, because signature collection is going to be a pain in the ass.  That's why I created BIP 10 (and already use it for offline transactions), but it might need to be expanded or supplemented with more user-friendliness.  Ugh...

For the audience (I'm sure etotheipi already knows this) "pain in the ass" might be more specifically translated as:  it is an Out Of Band problem.

You definitely need to collect together the keys somehow.

Pages:
Jump to: