1

我正在关注此文档页面,以找出公钥、Waves 测试网地址和 Waves 主网地址之间的关系。

我编写了这段代码片段,输入了我从 Waves Keeper 获得的 pub 密钥和地址:

const base58 = require('bs58')
const blake2b = require('blakejs')
const keccak = require('keccak256')

const pubKey_58 = '4DRwrsAPmw4aJ421WLhkLQwSojHbtGEX9TJA7ALWJfUf'
const pubKey_hex = base58.decode(pubKey_58)
const pubKey_blake = blake2b.blake2bHex(pubKey_hex, null, 32)
const pubKey_kck = keccak(pubKey_blake)

console.log(`Key base58: ${pubKey_58}`)
console.log(`Key hex: ${pubKey_hex.toString('hex')}`)
console.log(`Key blake: ${pubKey_blake.toString('hex')}`)
console.log(`\nKeccak of blake (real vs expected short) \nRe: ${pubKey_kck.toString('hex')}\nEx: 42277bd8eaff21ec56624ab8c003f70673510e74`)

这是我得到的输出: 在此处输入图像描述

显然,手动导出的地址是不同的。我错过了什么?

4

1 回答 1

0

您还可以使用内置函数从公钥获取地址:

addressFromPublicKey(publicKey: ByteVector): Address
于 2019-06-20T13:50:16.283 回答