WIP for automatic network join
This commit is contained in:
parent
ef3c8e2865
commit
d62dbeffca
12 changed files with 73 additions and 76 deletions
|
|
@ -16,13 +16,17 @@ function PrivateKey(opts) {
|
|||
var init = opts.extendedPrivateKeyString || this.network.name;
|
||||
this.bip = opts.BIP32 || new BIP32(init);
|
||||
this.privateKeyCache = opts.privateKeyCache || {};
|
||||
this._calcId();
|
||||
};
|
||||
|
||||
PrivateKey.prototype._calcId = function() {
|
||||
this.id = util.ripe160(this.bip.extendedPublicKey).toString('hex');
|
||||
PrivateKey.prototype.getId = function(prefix) {
|
||||
var buf = this.bip.extendedPublicKey;
|
||||
if (prefix) {
|
||||
buf = Buffer.concat([prefix, this.bip.extendedPublicKey]);
|
||||
}
|
||||
return util.ripe160(buf).toString('hex');
|
||||
};
|
||||
|
||||
|
||||
PrivateKey.fromObj = function(obj) {
|
||||
return new PrivateKey(obj);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue