1

I'm trying to figure out multisigs and have just created a 2 of 3 multisig as follows:

createmultisig 2 '["public_key_1","public_key_2","public_key_3"]'

This returns 2 values

Value 1: Address

Value 2: redeemScript

Now, if I want to fund this multisig, where do I send the funds? I typed in Value 1 into blockr.io, and it said that is an invalid key. So how do I get the public key for that multisig?

I am trying to learn the hard way, using bitcoin-core.

So basically, for the next step in my learning, I want to send that multisig some funds using the testnet, but I don't know where to get the public key for that multisig.

1 Answer 1

1

A "multisig address" is actually a Pay to script hash (P2SH) address. Unlike normal bitcoin addresses that start with 1, P2SH addresses start with 3 (on the main network, 2 on the testnet). How this works is explained by the P2SH BIP16 wiki page. Essentially, you pay coins to a special address that is a hash of the redeem script. To claim the transaction, one must provide a redeem script that hashes to the correct address, and also provide conditions that make the redeem script evaluate to True.

In your example, paying the multisig is really easy: Just copy-paste whatever value you got in the address field into your wallet and pay it just like you would a regular transaction.

Claiming the funds in a multisig is a little tricky. First, you must know the redeem script. Hopefully, you saved it, and you also gave it to the other key owners so they could verify the P2SH address is fair (their key is in it). If you lost the redeem script, reenter the createmultisig command with the same parameters and the same public keys in the same order. You're guaranteed to get the same redeem script and the same address.

Then you need to generate and sign the transaction, which is pretty difficult with the core client. You're going to find it simpler if you use a ready-made program.

Essentially, your transaction that paid your multisig address had an output that looked like this:

<hash> OP_EQUAL

and the transaction that spends from the multisig will sign that input with the signature script:

OP_FALSE <Signature1> <Signature2> <redeemScript>

where the redeemScript is what you got when generating the address, serialized and pushed onto the stack. The redeemScript must hash to the value specified by the output. Note that <Signature1> <Signature3> and <Signature2> <Signature3> would also validate, but not any other order. You also can't have more signatures than required: if it's a 2-of-3 multisig, you need exactly 2 signatures, not at least 2, so <Signature1> <Signature2> <Signature3> won't work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.