Created
June 18, 2014 13:22
-
-
Save yemel/03f1af168cfa02ea469d to your computer and use it in GitHub Desktop.
Bitcore - Key generation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bitcore = require('bitcore'); | |
bitcore.buffertools.extend(); | |
var k1 = new bitcore.Key.generateSync(); | |
var pk1 = k1.private.toHex(); // save private key | |
// Load Key: | |
var k = new bitcore.Key(); | |
var pkshex = 'b7dafe35d7d1aab78b53982c8ba554584518f86d50af565c98e053613c8f15e0'; // the saved key | |
k.private = new Buffer(pkshex).fromHex(); | |
k.regenerateSync(); | |
// Address From Key: | |
var hash = bitcore.util.sha256ripe160(k.public); | |
var version = bitcore.networks.livenet.addressVersion; | |
var addr = new bitcore.Address(version, hash).toString(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment