Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // generate bitcoin address, private key, QR Code and update information in the HTML
- // idPostFix: 1, 2, 3, etc.
- generateNewWallet: function (idPostFix) {
- console.log(idPostFix);
- if (ninja.wallets.paperwallet.encrypt) {
- var compressed = true;
- ninja.privateKey.BIP38GenerateECAddressAsync(ninja.wallets.paperwallet.intermediatePoint, compressed, function (address, encryptedKey) {
- Bitcoin.KeyPool.push(new Bitcoin.Bip38Key(address, encryptedKey));
- if (ninja.wallets.paperwallet.useArtisticWallet) {
- ninja.wallets.paperwallet.showArtisticWallet(idPostFix, address, encryptedKey);
- }
- else {
- ninja.wallets.paperwallet.showWallet(idPostFix, address, encryptedKey);
- }
- });
- }
- else {
- if (pv_key_list[idPostFix-1] == null)
- return;
- var key = new Bitcoin.ECKey(pv_key_list[idPostFix-1]);
- key.setCompressed(false);
- var bitcore = require('bitcore-lib');
- var p2shAddress = bitcore.Address.payingTo(
- bitcore.Script.empty()
- .add(bitcore.crypto.BN.fromNumber(1521920700).toScriptNumBuffer())
- .add('OP_CHECKLOCKTIMEVERIFY')
- .add('OP_DROP')
- .add(bitcore.Script.buildPublicKeyHashOut( key.getBitcoinAddress()))
- ).toString();
- console.log(p2shAddress);
- var privateKeyWif = key.getBitcoinWalletImportFormat();
- if (ninja.wallets.paperwallet.useArtisticWallet) {
- ninja.wallets.paperwallet.showArtisticWallet(idPostFix, p2shAddress, privateKeyWif);
- }
- else {
- ninja.wallets.paperwallet.showWallet(idPostFix, p2shAddress, privateKeyWif);
- }
- }
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement