ECPair: use toBase58Check
This commit is contained in:
parent
85e3cce00e
commit
e52c0d5b67
1 changed files with 2 additions and 8 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
var baddress = require('./address')
|
||||||
var bcrypto = require('./crypto')
|
var bcrypto = require('./crypto')
|
||||||
var bs58check = require('bs58check')
|
var bs58check = require('bs58check')
|
||||||
var ecdsa = require('./ecdsa')
|
var ecdsa = require('./ecdsa')
|
||||||
|
@ -97,14 +98,7 @@ ECPair.makeRandom = function (options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ECPair.prototype.getAddress = function () {
|
ECPair.prototype.getAddress = function () {
|
||||||
var pubKey = this.getPublicKeyBuffer()
|
return baddress.toBase58Check(bcrypto.hash160(this.getPublicKeyBuffer()), this.getNetwork().pubKeyHash)
|
||||||
var pubKeyHash = bcrypto.hash160(pubKey)
|
|
||||||
|
|
||||||
var payload = new Buffer(21)
|
|
||||||
payload.writeUInt8(this.network.pubKeyHash, 0)
|
|
||||||
pubKeyHash.copy(payload, 1)
|
|
||||||
|
|
||||||
return bs58check.encode(payload)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ECPair.prototype.getNetwork = function () {
|
ECPair.prototype.getNetwork = function () {
|
||||||
|
|
Loading…
Reference in a new issue