<p>I have the following code</p>

<pre><code>const script = this.app.env.bitcoin.script.compile([
hashOpcode,
Buffer.from(secretHash, "hex"),
this.app.env.bitcoin.opcodes.OP_EQUALVERIFY,

 Buffer.from(recipientPublicKey, "hex"),
 this.app.env.bitcoin.opcodes.OP_EQUAL,
 this.app.env.bitcoin.opcodes.OP_IF,

 Buffer.from(recipientPublicKey, "hex"),
 this.app.env.bitcoin.opcodes.OP_CHECKSIG
])
</code></pre>

<p>But i want to pass one more address. Like this:</p>

<pre><code>Buffer.from(recipientPublicKey, "hex"),
this.app.env.bitcoin.opcodes.OP_EQUAL,
this.app.env.bitcoin.opcodes.OP_AND,
Buffer.from(exchangePublicKey, "hex"),
this.app.env.bitcoin.opcodes.OP_EQUAL,
this.app.env.bitcoin.opcodes.OP_IF,

Buffer.from(recipientPublicKey, "hex"),
this.app.env.bitcoin.opcodes.OP_CHECKMULTISIG,
this.app.env.bitcoin.opcodes.OP_AND,
Buffer.from(exchangePublicKey, "hex"),
this.app.env.bitcoin.opcodes.OP_CHECKMULTISIG,
this.app.env.bitcoin.opcodes.OP_ELSE,
</code></pre>

<p>But its not working and i am getting only on 1 in txout. whats the correct way to add another multisig address ?</p>

<p>Just want to follow this pattern:</p>

<pre><code>redeem script: 2 &lt;pubKey1&gt; &lt;pubKey2&gt; &lt;pubKey3&gt; 3 OP_CHECKMULTISIG 

</code></pre>

CC BY-SA 4.0
2019-05-28T21:43:46.013Z
in which project/library is this command defined? `this.app.env.bitcoin.script.compile`
JBaczuk
CC BY-SA 4.0
2019-05-30T07:48:27.500Z
Sorry for late reply
https://github.com/swaponline/swap.core/blob/9295ead434117c995c33976782aa2fac8361becf/src/swap.swaps/BtcSwap.js#L183
Aqeel
<multi-signature><p2sh>
Pass Multiple addresses in redeem p2sh script
Aqeel
# Pass Multiple addresses in redeem p2sh script

(Asked by: username_0 on 2019-05-27)

I have the following code
const script = this.app.env.bitcoin.script.compile([
hashOpcode,
Buffer.from(secretHash, "hex"),
this.app.env.bitcoin.opcodes.OP_EQUALVERIFY,

 Buffer.from(recipientPublicKey, "hex"),
 this.app.env.bitcoin.opcodes.OP_EQUAL,
 this.app.env.bitcoin.opcodes.OP_IF,

 Buffer.from(recipientPublicKey, "hex"),
 this.app.env.bitcoin.opcodes.OP_CHECKSIG
])

But i want to pass one more address. Like this:
Buffer.from(recipientPublicKey, "hex"),
this.app.env.bitcoin.opcodes.OP_EQUAL,
this.app.env.bitcoin.opcodes.OP_AND,
Buffer.from(exchangePublicKey, "hex"),
this.app.env.bitcoin.opcodes.OP_EQUAL,
this.app.env.bitcoin.opcodes.OP_IF,

Buffer.from(recipientPublicKey, "hex"),
this.app.env.bitcoin.opcodes.OP_CHECKMULTISIG,
this.app.env.bitcoin.opcodes.OP_AND,
Buffer.from(exchangePublicKey, "hex"),
this.app.env.bitcoin.opcodes.OP_CHECKMULTISIG,
this.app.env.bitcoin.opcodes.OP_ELSE,

But its not working and i am getting only on 1 in txout. whats the correct way to add another multisig address ?
Just want to follow this pattern:
redeem script: 2    3 OP_CHECKMULTISIG

**Tags:** multi-signature, p2sh

> **Comments:**
> **username_1**: in which project/library is this command defined? `this.app.env.bitcoin.script.compile`  
> **username_0**: Sorry for late reply https://github.com/swaponline/swap.core/blob/9295ead434117c995c33976782aa2fac8361becf/src/swap.swaps/BtcSwap.js#L183  

---

## 0 answers

