Skip to content

Instantly share code, notes, and snippets.

@williamcotton
Last active August 29, 2015 14:22
Show Gist options
  • Save williamcotton/aeaf8b9b4f3dcd509a83 to your computer and use it in GitHub Desktop.
Save williamcotton/aeaf8b9b4f3dcd509a83 to your computer and use it in GitHub Desktop.
var bitstore = require("bitstore");
document.getElementById("generate-bitstore-client").addEventListener("click", function(event) {
var signMessage = function (message, cb) {
var key = wallet.getPrivateKey(0);
var network = bitcoin.networks.testnet;
cb(null, bitcoin.Message.sign(key, message, network).toString('base64'));
};
var bitstoreClient = bitstore({
network: 'testnet',
address: address,
signMessage: signMessage
});
bitstoreClient.wallet.get(function (err, res) {
bitstoreDepositAddress = res.body.deposit_address;
bitstoreBalance = res.body.balance;
document.getElementById("bitstore-deposit-address").innerHTML = bitstoreDepositAddress;
document.getElementById("bitstore-balance").innerHTML = bitstoreBalance;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment