Skip to content

Instantly share code, notes, and snippets.

@williamcotton
Last active August 29, 2015 14:22
Show Gist options
  • Save williamcotton/ba3530f6f0b7bbce10a5 to your computer and use it in GitHub Desktop.
Save williamcotton/ba3530f6f0b7bbce10a5 to your computer and use it in GitHub Desktop.
Create a Bitcoin wallet
var bitcoin = require('bitcoinjs-lib');
document.getElementById("generate-wallet").addEventListener("click", function(event) {
var seedString = document.getElementById("brainwallet-seed").value;
seed = bitcoin.crypto.sha256(seedString);
wallet = new bitcoin.Wallet(seed, bitcoin.networks.testnet);
address = wallet.generateAddress();
document.getElementById("wallet-address").innerHTML = address;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment