Last active
August 29, 2015 14:19
-
-
Save rjmacarthy/d7f18848d05f87e6db49 to your computer and use it in GitHub Desktop.
Bitcoin 2 of 3 Multisig Address Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var privateKeys = []; | |
var publicKeys = []; | |
var privKeysStr = []; | |
for (var i = 0; i < 3; i++) { | |
var privateKey = new bitcore.PrivateKey(); | |
privKeysStr.push(privateKey.toString()); | |
privateKeys.push(privateKey); | |
} | |
_.forEach(privateKeys, function(key) { | |
var address = new bitcore.PublicKey(key).toString(); | |
publicKeys.push(address); | |
}); | |
var p2shAddress = new bitcore.Address(publicKeys, 2); | |
var multiSigAddress = p2shAddress.toString(); // Multisig address | |
var build = bitcore.Script.buildMultisigOut(publicKeys, 2); | |
var redeemScript = build.toScriptHashOut().toString(); // reddemScript |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment