From 4dfc681f71bc6d1181d24a3bd0d462bbd6b60beb Mon Sep 17 00:00:00 2001 From: Matthew Leon Date: Thu, 19 Dec 2019 15:36:44 -0500 Subject: fix Ethereum xpub derivation --- src/js/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/js/index.js b/src/js/index.js index d843ee1..92772f6 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -1128,9 +1128,9 @@ } // Ethereum values are different if (networkIsEthereum()) { - var privKeyBuffer = keyPair.d.toBuffer(32); - privkey = privKeyBuffer.toString('hex'); - var addressBuffer = libs.ethUtil.privateToAddress(privKeyBuffer); + var pubkeyBuffer = keyPair.getPublicKeyBuffer(); + var ethPubkey = libs.ethUtil.importPublic(pubkeyBuffer); + var addressBuffer = libs.ethUtil.publicToAddress(ethPubkey); var hexAddress = addressBuffer.toString('hex'); var checksumAddress = libs.ethUtil.toChecksumAddress(hexAddress); address = libs.ethUtil.addHexPrefix(checksumAddress); -- cgit v1.2.3