File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,23 @@ console.log(tx.toHex())
106
106
// You could now push the transaction onto the Bitcoin network manually (see https://blockchain.info/pushtx)
107
107
```
108
108
109
+ ### Creating a P2SH Multsig Address
110
+
111
+ ``` javascript
112
+ var bitcoin = require (' bitcoinjs-lib' )
113
+
114
+ var privKeys = [bitcoin .ECKey .makeRandom (), bitcoin .ECKey .makeRandom (), bitcoin .ECKey .makeRandom ()]
115
+ var pubKeys = privKeys .map (function (x ) { return x .pub })
116
+
117
+ var redeemScript = bitcoin .scripts .multisigOutput (2 , pubKeys) // 2 of 3
118
+ var scriptPubKey = bitcoin .scripts .scriptHashOutput (redeemScript .getHash ())
119
+
120
+ var multisigAddress = bitcoin .Address .fromOutputScript (scriptPubKey).toString ()
121
+
122
+ console .log (" multisigP2SH:" , multisigAddress)
123
+ ```
124
+
125
+
109
126
110
127
## Projects utilizing BitcoinJS
111
128
You can’t perform that action at this time.
0 commit comments