<p>I stole most of the answer from Andreas' book :-)</p>

<p>The bitcoin developer docs provide this <a href="https://bitcoin.org/en/developer-guide#pay-to-script-hash-p2sh" rel="nofollow noreferrer">link here</a>, which goes over P2SH to multisig. The idea is to create a so called redeem script, which is a ripemd160(sha256(sigscript)).  </p>

<p>Example from the book:</p>

<pre><code>Redeem Script:    2 PubKey1 PubKey2 PubKey3 PubKey4 PubKey5 5 CHECKMULTISIG
Locking Script:   HASH160 &lt;20-byte hash of redeem script&gt; EQUAL
Unlocking Script: Sig1 Sig2 &lt;redeem script&gt;
</code></pre>

<p>see Andreas' book "Masterig Bitcoin, 2nd edition", page 152ff or in the GitHub version <a href="https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch07.asciidoc#with_p2sh" rel="nofollow noreferrer">here</a>.
The real book at <a href="http://chimera.labs.oreilly.com/books/1234000001802/index.html" rel="nofollow noreferrer">http://chimera.labs.oreilly.com/books/1234000001802/index.html</a> </p>

<blockquote>
  <p>how to create multi-signature address and redeem script without using
  bitcoind? What algorithm is used?</p>
</blockquote>

<p>you can use any hashing tools or libraries, Andreas shows with the "bx" library, openssl would do as well. </p>

CC BY-SA 4.0
2018-11-22T18:46:34.380Z
2018-11-22T18:46:34.380Z
pebwindkraft
<p>I know you can create a multisignature address with the command:</p>

<pre><code>bitcoind createmultisig 2 ["pubkey1", "pubkey2", "pubkey3"]
</code></pre>

<p>As described here: <a href="https://gist.github.com/gavinandresen/3966071" rel="nofollow noreferrer">https://gist.github.com/gavinandresen/3966071</a></p>

<p>This command returns the address (starting with character '3') and the redeem script.</p>

<p>My question: how to create multi-signature address and redeem script without using bitcoind? What algorithm is used?</p>

<p>Could you point me to some sources?</p>

<bitcoind><multi-signature>
What is the algorithm behind multisignature address and redeem script?
tcqq
# What is the algorithm behind multisignature address and redeem script?

(Asked by: username_0 on 2018-11-21)

I know you can create a multisignature address with the command:

```
bitcoind createmultisig 2 ["pubkey1", "pubkey2", "pubkey3"]

```

As described here: <https://gist.github.com/gavinandresen/3966071>

This command returns the address (starting with character '3') and the redeem script.

My question: how to create multi-signature address and redeem script without using bitcoind? What algorithm is used?

Could you point me to some sources?

**Tags:** bitcoind, multi-signature


---

## 1 answers

### Answer by username_1 on 2018-11-22. Score: 1 | Accepted answer

I stole most of the answer from Andreas' book :-)

The bitcoin developer docs provide this [link here](https://bitcoin.org/en/developer-guide#pay-to-script-hash-p2sh), which goes over P2SH to multisig. The idea is to create a so called redeem script, which is a ripemd160(sha256(sigscript)).

Example from the book:

```
Redeem Script:    2 PubKey1 PubKey2 PubKey3 PubKey4 PubKey5 5 CHECKMULTISIG
Locking Script:   HASH160 <20-byte hash of redeem script> EQUAL
Unlocking Script: Sig1 Sig2 <redeem script>

```

see Andreas' book "Masterig Bitcoin, 2nd edition", page 152ff or in the GitHub version [here](https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch07.asciidoc#with_p2sh).
The real book at <http://chimera.labs.oreilly.com/books/1234000001802/index.html>

> how to create multi-signature address and redeem script without using
> bitcoind? What algorithm is used?

you can use any hashing tools or libraries, Andreas shows with the "bx" library, openssl would do as well.


---

