So, I finally managed to master Multisig transactions, after being the first person to send funds to a Multisig address on the production network!
Without further ado, here’s the tutorial! This was made on the QT wallet, in a Windows machine.
Let’s imagine the following:
Alice wants to buy a bag of candies from John. John says the candies are 6.08 RDD. For their security, both agree on using an Escrow that supports Multisig.
For this to happen, Alice and John must give the Escrow the pubkey of an address they control.
For this, they must open the QT wallet and access Help -> Debug Window.
On that window, they’re going to do the following
validateaddress Reddcoin address
This outputs many things, including the pubkey for the address. Here, we have Alice’s and John’s pubkeys:
Both of them must send these pubkey’s to their Escrow, who’s going to use the information and his own pubkey to make a Multisig address, by doing so in his Debug Console:
In this case, we are making a Multisig address that requires 2 signatures (hence the 2 we wrote after createmultisig). You can make Multisig addresses that require 3 signatures, for example.
This gives the following output:
It is very important for the escrow to save this information (Address + Redeem Script). Otherwise, the Escrowed coins may be lost. This information can be shared safely with all the participants in the transaction.
Meanwhile, Alice recieves the Multisig address and funds it right away, because she wants those candies shipped fast! John checks the address, sees that Alice has funded it, and ships the candies.
(Note: the Multisig address should be funded with the candy price + 0.001 RDD, so that when the funds get sent to John, the transaction can include the 0.001 RDD as a fee. This way, we are making sure the transaction gets processed really quick.)
Alice gets the candies (nom nom!!) and authorizes the funds to be released to John.
Since everything is fine, the Escrow agent is ready to release the funds. So he checks Alice’s txid to the Multisig address on the block explorer, and he sends the command getrawtransaction followed by that txid and a 1, which gives this output:
Now the escrow is going to create a raw transaction to John’s address. For this you need the txid again, the vout (which we can see after we send the getrawtransaction command), the Redeem Script (the one we got when we created out Multisig address earlier), John’s address and the amount we want to send, like so:
This gives us the new transaction, in hex output.
Now the fun part! We must sign this transaction. For this we need the hex we created in the previous step, the txid from when Alice sent the coins to the Multisig address, the vout, ScriptPubKey (found on the getrawtransaction command), the Redeem Script and the Escrow’s private key (you can do dumpprivkey address to see it):
As you can see, it says “false” in the end. Don’t worry, it says false because this is Multisig! The Escrow is only approving half of the transaction. Now we need Alice (or John, if Alice is too busy eating candy) to approve the second part of the transaction. For this, the Escrow needs to send Alice the hex he got on the last step, so she can do exactly the same thing he did, but with this new hex and her private key
As you can see, we finally have “true”. This means both signatures have been approved, and we are ready to send the funds from the Escrow/Multisig address to John. To do this, we must “sendrawtransaction”, follow by the hex. This can either be done straight away by Alice (or John, if he’s the one signing the last part), or the hex can be sent to the Escrow, and he can release the funds himself:
And there we have it, funds released! The output of this command is the new txid
John has his beloved Reddcoin, and Alice is sharing candy with her friends!
You can check everything done in this tutorial through the block explorer: http://live.reddcoin.com/address/3GRsiQnj81qte2Y2X4BYL5KLHDr8g5LexN
Thanks to laudney and the Reddcoin developers for having Multisig on our beloved Reddcoin! Also thanks to ReddcoinRocks for the help, and all the faucet operators around there, as they were the ones giving me the test funds!
If you have any suggestions to make this tutorial better, please say so! :)
If you think this was awesome feel free to fill up my tip jar at Rddtip7pfQcd9ZtK7Lgpwiec4YYmisQQWC, or just say thanks! :D