<p>you run bitcoinjs-lib in <code>main-net mode</code> and it generates the human-readable address for main-net</p>

<p>bitcoin-cli you execute with <code>-testnet</code> parameter and got address for test-net</p>

<p>you can check that these hashes are the same:</p>

<p><a href="https://testnet.smartbit.com.au/tx/8c67e4d3264696d222d5a72c70c8806eb3f12b9a02d1bc80554ab00803be86c0" rel="nofollow noreferrer">https://testnet.smartbit.com.au/tx/8c67e4d3264696d222d5a72c70c8806eb3f12b9a02d1bc80554ab00803be86c0</a></p>

<p><a href="https://blockchain.info/address/38tjRCFaQWQ269oGDpEkdxh5iPgxh7kvtB" rel="nofollow noreferrer">https://blockchain.info/address/38tjRCFaQWQ269oGDpEkdxh5iPgxh7kvtB</a></p>

<p>both are <strong>4f0017ef9291b625bec1d7efacc246a37b293682</strong></p>

CC BY-SA 3.0
2017-08-31T08:28:34.473Z
Thanks for your answer. I want upvote your answer but I don't have enough reputations. Thanks again.
Peili Liang
CC BY-SA 3.0
2017-08-31T08:13:55.760Z
2017-08-31T08:13:55.760Z
amaclin
<p>When I use <code>bitcoin-cli -testnet</code> to generate a 2-of-3 address, the code: </p>

<pre><code>bitcoin-cli -testnet createmultisig 2 '''
 [
   "03b91ff254ae3bb3861e4a6c16ab356d6c52ccfd2b58bedf0dda84657dfd9d9afc",
   "039f1475fb37d91ed65765c897acbdc37da3a7aba19f5b8ad5ff22a994e8350798", 
   "030ee8793fa2cb93f0cfd475b990cbaa48a28d83bd8f434348607368e52644febf"
 ]'''
</code></pre>

<p>the result is </p>

<pre><code>"address": "2MzSwUwBc1xuNHwRotwrdFugLvju8VV9uPT",
</code></pre>

<p>But when I use <code>bitcoinjs-lib</code>, the code is:</p>

<pre><code>var pubKeys = [
'03b91ff254ae3bb3861e4a6c16ab356d6c52ccfd2b58bedf0dda84657dfd9d9afc',
'039f1475fb37d91ed65765c897acbdc37da3a7aba19f5b8ad5ff22a994e8350798',
'030ee8793fa2cb93f0cfd475b990cbaa48a28d83bd8f434348607368e52644febf'
].map(function(hex){
return new Buffer(hex, 'hex');
});


var redeemScript = bitcoin.script.multisig.output.encode(2, pubKeys); // 2 of 3
var scriptPubkey = bitcoin.script.scriptHash.output.encode(bitcoin.crypto.hash160(redeemScript));
var address = bitcoin.address.fromOutputScript(scriptPubkey);
</code></pre>

<p>Now the address changed to</p>

<pre><code>38tjRCFaQWQ269oGDpEkdxh5iPgxh7kvtB
</code></pre>

<p>How could this happen? Did I do something wrong? </p>

<multi-signature>
different multisig address from the same public keys
Peili Liang
# different multisig address from the same public keys

(Asked by: username_0 on 2017-08-31)

When I use `bitcoin-cli -testnet` to generate a 2-of-3 address, the code:

```
bitcoin-cli -testnet createmultisig 2 '''
 [
   "03b91ff254ae3bb3861e4a6c16ab356d6c52ccfd2b58bedf0dda84657dfd9d9afc",
   "039f1475fb37d91ed65765c897acbdc37da3a7aba19f5b8ad5ff22a994e8350798", 
   "030ee8793fa2cb93f0cfd475b990cbaa48a28d83bd8f434348607368e52644febf"
 ]'''

```

the result is

```
"address": "2MzSwUwBc1xuNHwRotwrdFugLvju8VV9uPT",

```

But when I use `bitcoinjs-lib`, the code is:

```
var pubKeys = [
'03b91ff254ae3bb3861e4a6c16ab356d6c52ccfd2b58bedf0dda84657dfd9d9afc',
'039f1475fb37d91ed65765c897acbdc37da3a7aba19f5b8ad5ff22a994e8350798',
'030ee8793fa2cb93f0cfd475b990cbaa48a28d83bd8f434348607368e52644febf'
].map(function(hex){
return new Buffer(hex, 'hex');
});

var redeemScript = bitcoin.script.multisig.output.encode(2, pubKeys); // 2 of 3
var scriptPubkey = bitcoin.script.scriptHash.output.encode(bitcoin.crypto.hash160(redeemScript));
var address = bitcoin.address.fromOutputScript(scriptPubkey);

```

Now the address changed to

```
38tjRCFaQWQ269oGDpEkdxh5iPgxh7kvtB

```

How could this happen? Did I do something wrong?

**Tags:** multi-signature


---

## 1 answers

### Answer by username_1 on 2017-08-31. Score: 3 | Accepted answer

you run bitcoinjs-lib in `main-net mode` and it generates the human-readable address for main-net

bitcoin-cli you execute with `-testnet` parameter and got address for test-net

you can check that these hashes are the same:

<https://testnet.smartbit.com.au/tx/8c67e4d3264696d222d5a72c70c8806eb3f12b9a02d1bc80554ab00803be86c0>

<https://blockchain.info/address/38tjRCFaQWQ269oGDpEkdxh5iPgxh7kvtB>

both are **4f0017ef9291b625bec1d7efacc246a37b293682**

> **Comments:**
> **username_0**: Thanks for your answer. I want upvote your answer but I don't have enough reputations. Thanks again.  

---

