User avatar
coinableS
Nickel Bitcoiner
Nickel Bitcoiner
Posts: 65
Joined: Wed Sep 30, 2015 6:06 am

Donate BTC of your choice to 1J9ikqFuwrzPbczsDkquA9uVYeq6dEehsj

Contact: Website Twitter

How To Create A Multisig Address and Spend From It

Sat Oct 03, 2015 3:53 am

Video: https://www.youtube.com/watch?v=YN2Vyu9RupU

https://www.youtube.com/watch?v=YN2Vyu9RupU

So multisig accounts are basically accounts that use more than one private key in order to send a transaction.
They are also known as P2SH (https://bitcoin.org/en/developer-guide# ... -hash-p2sh)

This is way you can secure your funds among multiple parties or you can do it by yourself to make your funds more secure (i.e. Keeping a private key at home and another in a safe deposit box, and/or with family member).

In order to create a multsig address by yourself you will need to have the bitcoin core software.

Here's a link to a cheat sheet of the commands in bitcoin core that you will use to create a multisig address: http://pastebin.com/nw2Tqg3U

1. Open up bitcoin core and go to the Menu -> Help -> Debug Window -> Console
2. Use the command getnewaddress to create a new address.
3. Repeat step 2, three times so that you have 3 new addresses.
4. Use the command validateaddress to get the PubKey. The PubKey is required to create a multisig address.
Example: validate address 1J9ikqFuwrzPbczsDkquA9uVYeq6dEehsj
5. Save the public key for each address that you generated. It is not possible to get the public key without having the private key.
6. Use the createmultisig command to create the multisig address.
If you do createmultisig 2 it will only require two private keys in order to spend.
If you do createmultisig 3 it will require 3 private keys to spend from the address.
The most common is 2 of 3 address, so you would use createmultisig 2
Example: createmultisig 2 '["asdf123ef1d2f3df","ef3dd2f1df1asdf12","ef12d3f21df2d41"]'
Refer to the cheat sheet link up above for these commands and format
This will create a new multisig address (starts with a 3) and the RedeemScript. Save both of these.
YOU WILL NEED THE REDEEM SCRIPT TO SEND FROM THIS ADDRESS

In order to spend from the address, you will need to create a raw transaction. You must be able to identify the inputs and transaction hashes.

8. In order to spend from an address you have to send coins to your multisig address first. You will need this transaction ID in order to spend the funds from this transaction.
9. use the command getrawtransaction txid 1 and this will provide the inputs and vout that out you need to spend from the address.
10. Copy the scriptPubKey from that transaction and take note of the N value aka vout
11. Use the command createrawtransaction
createrawtransaction '[{"txid":"","vout":}]' '{"receive_address":0.0123}'
BE VERY CAREFUL HERE. IF YOU DON'T SPEND THE ENTIRE AMOUNT OF THE INPUT ANY LEFT OVER FUNDS WILL BE SENT AS A MINING FEE. MANY PEOPLE HAVE LOST LOTS OF MONEY THIS WAY. IT'S BEST TO SPEND THE FULL AMOUNT MINUS 0.0001.
OR YOU CAN SPECIFY A CHANGE ADDRESS
createrawtransaction '[{"txid":"","vout":}]' '{"receive_address":0.0123,"change_address":0.01}'
12. After executing the createrawtransaction it will respond with a hash. Copy that.
13. Use the command signrawtransaction to sign the hash
signrawtransaction 'hash_from_createraw' '[{"txid":"","vout":,"scriptPubKey":"","redeemScript":""}]' '["priv_key"]'
Only put it one private key here. You will provide the 2nd private key in the next step.
14. After executing the signrawtransaction it will repond with a hash. Copy this.
15. Do another signrawtransaction but this time the hash will be from step 13 and the private key portion will be one of your other private keys.
signrawtransaction 'hash_from_signraw' '[{"txid":"","vout":,"scriptPubKey":"","redeemScript":""}]' '["priv_key2"]'
16. After executing this will provide you with another hash. Copy it.
17. Now we have a signed transaction. You can give this to anyone to broadcast on the network and they won't know your private keys. Or just execute it yourself.
18. Use sendrawtransaction followed by the hash.
sendrawtransaction hash_from_2nd_signraw
19. BAMM YOUR DONE! Transaction sent!!

That's how you can create multisig address and spend from them using bitcoin core and raw transactions!
With great power comes with great responsibility when using raw transactions 8-) 8-)

User avatar
bitkilo
Platinum Bitcoiner
Platinum Bitcoiner
Posts: 3210
Joined: Sat Sep 26, 2015 4:08 am

Donate BTC of your choice to 1DJcTrvdGsmKr7LdriVizkVmkcXWoG12nt

Re: How To Create A Multisig Address and Spend From It

Sat Oct 03, 2015 5:48 am

Thanks for creating this tutorial, great information for anyone wanting to learn more about multi-sig (including myself).
Your warning to user: VERY CAREFUL HERE. IF YOU DON'T SPEND THE ENTIRE AMOUNT OF THE INPUT ANY LEFT OVER FUNDS WILL BE SENT AS A MINING FEE. MANY PEOPLE HAVE LOST LOTS OF MONEY THIS WAY. IT'S BEST TO SPEND THE FULL AMOUNT MINUS 0.0001
Is a very important fact that anyone consitering using multi-sig needs to know and understand.

I used a Mycelium entropy to create 2 of 3 paper wallets using Shamir’s 2-of-3 Secret Sharing, you can find out more regarding this here: https://github.com/cetuscetus/btctool/b ... .mediawiki , but this is not multi-sig.

I will link this thread to the moderators board with a request for a subsection just for BTC tutorials.

Thanks for your help and keep up the good work, we need more like you on this forum. :)
Please help Ross and his family during this hard time by donating to the https://freeross.org/ fund. Play at the best provably fair Bitcoin games site here: games.bitcoin.com Need a fantastic Bitcoin wallet Pick up some great Bitcoin.com swag here

dill
Nickel Bitcoiner
Nickel Bitcoiner
Posts: 35
Joined: Fri Sep 18, 2015 11:11 pm

Re: How To Create A Multisig Address and Spend From It

Sat Oct 03, 2015 6:04 am

And on the other end of the difficulty spectrum is Copay. It allows the easy creation of multisig with very little room to screw up. You can even use it with yourself by installing it on multiple devices you own. Just remember to write down the seed for every device or person you invite to the multisig setup and it makes it very hard to lose your coins through theft or mistakes.

User avatar
coinableS
Nickel Bitcoiner
Nickel Bitcoiner
Posts: 65
Joined: Wed Sep 30, 2015 6:06 am

Donate BTC of your choice to 1J9ikqFuwrzPbczsDkquA9uVYeq6dEehsj

Contact: Website Twitter

Re: How To Create A Multisig Address and Spend From It

Wed Oct 07, 2015 4:54 am

And on the other end of the difficulty spectrum is Copay. It allows the easy creation of multisig with very little room to screw up. You can even use it with yourself by installing it on multiple devices you own. Just remember to write down the seed for every device or person you invite to the multisig setup and it makes it very hard to lose your coins through theft or mistakes.
How many other services can read/work with an HD multisig seed created by copay? Does the service have to remain open for one to recover their funds? I like that with core I know I don't have to rely on copay to still be active in order to use my funds in the future.

EDIT: Checked their site, they are open source. So technically you could save the source code and use it later yourself.

Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 1 guest