Brain-Wallet

從大腦錢包生成隔離見證(bc1)地址?

  • February 22, 2019

是否有任何可以生成隔離見證(bc1)地址的大腦錢包生成器?

Memory Paper Wallet能夠從大腦錢包片語生成 bc1 地址。

<https://www.xcubicle.com/memory-paper-wallet-bitcoin-ethereum-monero-ardor-litecoin>

這是一個使用 bitcoinjs-lib 的範例:

let bitcoin = require('bitcoinjs-lib');
let assert = require('assert')
let bigi = require('bigi')


let NETWORK = bitcoin.networks.bitcoin;
let brainwallet = "This is my brain wallet and it is less secure than a CSPRNG source";
let hash = bitcoin.crypto.sha256(brainwallet);
let d = bigi.fromBuffer(hash);
let nkeyp = new bitcoin.ECPair(d);
let wif = nkeyp.toWIF();
let pubKey = nkeyp.getPublicKeyBuffer();
let scriptPubKey = bitcoin.script.witnessPubKeyHash.output.encode(bitcoin.crypto.hash160(pubKey))
let address = bitcoin.address.fromOutputScript(scriptPubKey);
console.log(address);
console.log(wif);

引用自:https://bitcoin.stackexchange.com/questions/62096