Last active
October 22, 2015 16:03
-
-
Save kaibakker/6e9b80f090f163602246 to your computer and use it in GitHub Desktop.
Node script that accepts wallet invitations and generates a Mnemonic backup for multisig Copay wallets
This file contains 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 Client = require('bitcore-wallet-client'); | |
var BWS_INSTANCE_URL = 'https://bws.bitpay.com/bws/api' | |
var secret = process.argv[2]; | |
var client = new Client({ | |
baseUrl: BWS_INSTANCE_URL, | |
verbose: false, | |
}); | |
// Create a Mnemonic backup prase | |
client.seedFromRandomWithMnemonic('livenet'); | |
// Join the wallet with name Backup key | |
client.joinWallet(secret, "Backup Key", {}, function(err, wallet) { | |
if(err) return; | |
client.openWallet(function(err, ret) { | |
if(err) return; | |
succes(wallet); | |
}); | |
}); | |
var succes = function(wallet) { | |
console.log('You succesfully joined: ' + wallet.name + '!'); | |
console.log("Write down the following 12 word backup prase:\n"); | |
console.log(client.getMnemonic()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How it works: