Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Andrew Vorobyov on May 17, 2012, 05:07:33 PM



Title: [Bounty] How-to Multi signature transactions
Post by: Andrew Vorobyov on May 17, 2012, 05:07:33 PM
Ok, I need to create multi signature transaction.. 2-of-3... What do I do?


Title: Re: How-to Multi signature transactions
Post by: Stephen Gornick on May 17, 2012, 06:29:35 PM
You are being a pioneer here:

 - https://gist.github.com/2305966
 - https://bitcointalk.org/index.php?topic=75481.0;all


Title: Re: How-to Multi signature transactions
Post by: Andrew Vorobyov on May 17, 2012, 06:36:03 PM
No no no... I need step by step tutorial...

For example 2 people have Bitcoin Qt installed on their PC what they need to do to make it...

5 BTC bounty


Title: Re: [Bounty] How-to Multi signature transactions
Post by: etotheipi on May 17, 2012, 07:57:08 PM
I've seen some of the online wallets accommodate multi-sig transactions, though that may have been before BIP 16, and I don't know if they're still doing it.

Alternatively, there are ways to do it if you want to go digging around on the command-line and doing crazy "hacker stuff", but you might just have to wait for client developers to get around to this.  I had grand plans for it in Armory, but I've had some other pressing priorities recently.  It will be on my list of priorities after Armory goes Beta (hopefully within a month).

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 (https://en.bitcoin.it/wiki/BIP_0010) (and already use it for offline transactions), but it might need to be expanded or supplemented with more user-friendliness.  Ugh...


Title: Re: [Bounty] How-to Multi signature transactions
Post by: Andrew Vorobyov on May 17, 2012, 08:32:50 PM
Command line guides will be OK


Title: Re: [Bounty] How-to Multi signature transactions
Post by: cbeast on May 17, 2012, 09:48:47 PM
I do not think BIP 11 has been implemented yet. We need the scriptPubKey function.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: Blazr on May 17, 2012, 09:51:21 PM
So wait, we can't do multi-sig transactions yet?

Then why is everyone screaming at Bitcoinica for not using them?

I thought BIP16 got the go ahead.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: cbeast on May 17, 2012, 10:48:33 PM
So wait, we can't do multi-sig transactions yet?

Then why is everyone screaming at Bitcoinica for not using them?

I thought BIP16 got the go ahead.
Bitcoinica did not encrypt their wallet. That's the issue with theft. Right now the only multisig transactions that can be done are sending to multiple addresses.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: caveden on May 17, 2012, 10:56:03 PM
So wait, we can't do multi-sig transactions yet?

You can. You always could, actually. The possibility was always there, with script (https://en.bitcoin.it/wiki/Script). It's just that there's no client that easily allows you to create your transaction with the appropriate script. You'll need to build it yourself, what's complicated.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: caveden on May 17, 2012, 11:02:02 PM
Bitcoinica did not encrypt their wallet. That's the issue with theft.

A hot wallet cannot be encrypted while the system is running, by definition.
Their problem was in part having too much money in the hot wallet, but mainly, using an unsafe method to share the root password of their server containing the hot wallet.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: Gavin Andresen on May 18, 2012, 01:20:53 AM
Ok, I need to create multi signature transaction.. 2-of-3... What do I do?
Gather (or generate) 3 bitcoin addresses, on whichever machines will be participating, using getnewaddress or getaccountaddress  RPC commands (or copy and paste from the GUI).

Get their public keys using the validateaddress RPC command 3 times.

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.

If you want to then SPEND the funds sent in that 2-of-3 transaction... that isn't implemented yet (well, if bitcoin has all 3 private keys in it's wallet then the funds will show up in the wallet's total balance and it may be selected to be spent like any other funds received by the wallet). "We" need to implement RPC calls to implement BIP 10 (https://en.bitcoin.it/wiki/BIP_0010) or something like it.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: jgarzik on May 18, 2012, 01:36:29 AM
A hot wallet cannot be encrypted while the system is running, by definition.

Well, it can (and should) be encrypted on-disk.

At least that makes it more difficult to steal private keys (must steal from memory).



Title: Re: [Bounty] How-to Multi signature transactions
Post by: Andrew Vorobyov on May 19, 2012, 07:51:09 PM
Code:
c:\Program Files (x86)\Bitcoin\daemon>bitcoind.exe addmultisigaddress 2 '["0446fc07bc99bef8e7a875249657c65e1f1793fd0bf45e2c39d539b6f8fcd44676acc552ab886c11eb08f4a275e7bb7dc4fdaf9c4
b2228856f168a69df7d216fbc","04df70eb0107ed08e1ddcd4b4d85d26bf8cca301f5c98fd15f5efef12ba4de72bfef7287f964e304207164c003029449740aaae2d6af1ff7ae3f6bb27f3012296c","046003581a3ff5bc3de
daa6da4834ce7bcd49d3f114ce15791f6b5de8b0cec81a46db2eb8cf84d2db845854c57788c7283ab4040aeb3595bc5c68303a17fdde7c8"]'


error: type mismatch '[0446fc07bc99bef8e7a875249657c65e1f1793fd0bf45e2c39d539b6f8fcd44676acc552ab886c11eb08f4a275e7bb7dc4fdaf9c4b2228856f168a69df7d216fbc,04df70eb0107ed08e1ddcd4b4d
85d26bf8cca301f5c98fd15f5efef12ba4de72bfef7287f964e304207164c003029449740aaae2d6af1ff7ae3f6bb27f3012296c,046003581a3ff5bc3dedaa6da4834ce7bcd49d3f114ce15791f6b5de8b0cec81a46db2eb8cf
84d2db845854c57788c7283ab4040aeb3595bc5c68303a17fdde7c8]'

Why?


Title: Re: How-to Multi signature transactions
Post by: Eli on May 22, 2012, 08:14:58 AM
No no no... I need step by step tutorial...

For example 2 people have Bitcoin Qt installed on their PC what they need to do to make it...

5 BTC bounty

I'm adding 25BTC bounty if this is done inside Safebit.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: Gavin Andresen on May 22, 2012, 01:18:19 PM
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.  


Title: Re: [Bounty] How-to Multi signature transactions
Post by: CIYAM on May 22, 2012, 01:39:01 PM
I don't know enough about Windows CLI quoting rules to get ["...","...","..."] passed un-modified to bitcoind.exe.  

It can be a bit frustrating dealing with cmd.exe and escaping - for "" characters you basically need to use a backslash (gets more complicated if going through a batch file) and for other characters (such as >, <, | or ^) you need to escape with a ^ character.

Example:

Code:
grep.exe ^>\", *.cpp

Will match a line such as follows:

... </p>", ...


Cheers,

Ian.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: Andrew Vorobyov on May 31, 2012, 12:15:45 PM
I did install fresh bitcoin and run command

Code:
santa@ubu:~$ bitcoind validateaddress 3EffXJKyYB9zWh2dhx2hcccqBK8DGC7x2x
{
    "isvalid" : true,
    "address" : "3EffXJKyYB9zWh2dhx2hcccqBK8DGC7x2x",
    "ismine" : false
}

If I run the same command after

Code:
bitcoind addmultisigaddress 2 '["0446fc07bc99bef8e7a875249657c65e1f1793fd0bf45e2c39d539b6f8fcd44676acc552ab886c11eb08f4a275e7bb7dc4fdaf9c4b2228856f168a69df7d216fbc","04df70eb0107ed08e1ddcd4b4d85d26bf8cca301f5c98fd15f5efef12ba4de72bfef7287f964e304207164c003029449740aaae2d6af1ff7ae3f6bb27f3012296c","046003581a3ff5bc3dedaa6da4834ce7bcd49d3f114ce15791f6b5de8b0cec81a46db2eb8cf84d2db845854c57788c7283ab4040aeb3595bc5c68303a17fdde7c8"]'

it gives me

Code:
santa@ubu:~$ bitcoind validateaddress 3EffXJKyYB9zWh2dhx2hcccqBK8DGC7x2x
{
    "isvalid" : true,
    "address" : "3EffXJKyYB9zWh2dhx2hcccqBK8DGC7x2x",
    "isscript" : true,
    "ismine" : false,
    "script" : "multisig",
    "addresses" : [
        "1HEmNY7Lpsqc81nP6JAymjGuuvdFLaqt1e",
        "1Gpuy32bmhtn3KL6dBDHdTHfMosXRH6xV4",
        "1AbU2FDgJRKejuY4e4XGYEfzo6uAGQ1Kyy"
    ],
    "sigsrequired" : 2,
    "account" : ""
}

Is there a way to disassemble any multisignature address on new bitcoin installation? I want to get this "addresses" section



Title: Re: [Bounty] How-to Multi signature transactions
Post by: Pieter Wuille on May 31, 2012, 12:25:18 PM
You cannot disassemble the script address without knowing the script. That's both an advantage and a disadvantage.

It means people do need to be told what keys are involved in a transaction, they can send a payment with just the script address. On the other hand, spending from a script address implies knowing the script.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: Andrew Vorobyov on May 31, 2012, 12:58:57 PM
Code:
bitcoind addmultisigaddress 2 '["0446fc07bc99bef8e7a875249657c65e1f1793fd0bf45e2c39d539b6f8fcd44676acc552ab886c11eb08f4a275e7bb7dc4fdaf9c4b2228856f168a69df7d216fbc","04df70eb0107ed08e1ddcd4b4d85d26bf8cca301f5c98fd15f5efef12ba4de72bfef7287f964e304207164c003029449740aaae2d6af1ff7ae3f6bb27f3012296c","046003581a3ff5bc3dedaa6da4834ce7bcd49d3f114ce15791f6b5de8b0cec81a46db2eb8cf84d2db845854c57788c7283ab4040aeb3595bc5c68303a17fdde7c8"]'

No matter how much time I run it it gives only one output address - 3EffXJKyYB9zWh2dhx2hcccqBK8DGC7x2x

How can I create several multisignature transactions using same addresses?


Title: Re: [Bounty] How-to Multi signature transactions
Post by: Gavin Andresen on May 31, 2012, 01:21:52 PM
How can I create several multisignature transactions using same addresses?
Use one of the send commands to send to the multisig address several times and you will create several multisig transactions.

addmultisigaddress does not create a transaction, it just creates a place for future transactions to go.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: ripper234 on September 17, 2012, 08:21:37 PM
Is there currently a GUI that supports multisig? Is it a part of bitcoin-qt 0.7?


Title: Re: [Bounty] How-to Multi signature transactions
Post by: jgarzik on September 18, 2012, 12:27:50 AM
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 (https://en.bitcoin.it/wiki/BIP_0010) (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.



Title: Re: [Bounty] How-to Multi signature transactions
Post by: jgarzik on September 18, 2012, 12:30:09 AM
Is there currently a GUI that supports multisig? Is it a part of bitcoin-qt 0.7?

It is only RPC at this point.



Title: Re: [Bounty] How-to Multi signature transactions
Post by: Jan on September 19, 2012, 11:14:36 AM
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.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: molecular on May 11, 2013, 09:48:54 AM
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?


Title: Re: [Bounty] How-to Multi signature transactions
Post by: dserrano5 on May 11, 2013, 10:12:12 AM
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 (https://gist.github.com/gavinandresen/3966071/raw/1f6cfa4208bc82ee5039876b4f065a705ce64df7/TwoOfThree.sh) was enough for me to play with it. You're interested in the "Create the spend-from-multisig transaction" part.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: molecular on May 11, 2013, 10:23:38 AM
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 (https://gist.github.com/gavinandresen/3966071/raw/1f6cfa4208bc82ee5039876b4f065a705ce64df7/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.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: benehsv on June 26, 2013, 12:15:48 PM
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


Title: Re: [Bounty] How-to Multi signature transactions
Post by: kjj on June 27, 2013, 11:35:45 AM
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.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: benehsv on June 28, 2013, 01:17:59 PM
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?


Title: Re: [Bounty] How-to Multi signature transactions
Post by: dserrano5 on June 28, 2013, 06:15:07 PM
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


Title: Re: [Bounty] How-to Multi signature transactions
Post by: omnibrain on June 30, 2013, 09:36:57 AM
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 (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.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: kjj on June 30, 2013, 12:12:30 PM
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.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: omnibrain on June 30, 2013, 12:47:08 PM
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




Title: Re: [Bounty] How-to Multi signature transactions
Post by: clicknbuyit on July 03, 2013, 12:08:47 PM
I need help on how to sign a message on bitcoin wallet 0.8.2. 

Thankyou.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: jgarzik on July 03, 2013, 04:16:41 PM
See txtool via https://bitcointalk.org/index.php?topic=249205.0 for a step-by-step multisig example.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: camponez on February 01, 2014, 06:57:29 PM
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....)?


Title: Re: [Bounty] How-to Multi signature transactions
Post by: ripper234 on March 23, 2014, 04:53:10 PM
https://bitcoin.stackexchange.com/questions/23893/what-are-the-limits-of-m-and-n-in-m-of-n-multisig-addresses

Quote
This method (http://bitcoin.stackexchange.com/a/10593/78) 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?


Title: Re: [Bounty] How-to Multi signature transactions
Post by: CIYAM on March 23, 2014, 04:57:17 PM
From what I read in the code only a 2 of 3 is *standard* currently.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: edmundedgar on March 27, 2014, 03:26:42 AM
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.


Title: Re: [Bounty] How-to Multi signature transactions
Post by: CIYAM on March 27, 2014, 03:57:42 AM
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.