Skip to content

Instantly share code, notes, and snippets.

@kaibakker
Last active October 22, 2015 16:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaibakker/6e9b80f090f163602246 to your computer and use it in GitHub Desktop.
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
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());
}
@kaibakker
Copy link
Author

How it works:

$ npm install bitcore-wallet-client
$ node backup.js [wallet_invitation_code]

You succesfully joined: Holiday wallet!
Write down the following 12 word backup prase:
only salad elegant muscle shop badge cloud diesel search pair bright control

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment