Javascript 使用js库复制Waves密钥派生过程

Javascript 使用js库复制Waves密钥派生过程,javascript,cryptography,wavesplatform,Javascript,Cryptography,Wavesplatform,下面我将分析公钥、Waves testnet地址和Waves mainnet地址之间的关系 我写了这段代码片段,输入了一个酒吧钥匙和我从Waves Keeper那里得到的地址: const base58 = require('bs58') const blake2b = require('blakejs') const keccak = require('keccak256') const pubKey_58 = '4DRwrsAPmw4aJ421WLhkLQwSojHbtGEX9TJA7AL

下面我将分析公钥、Waves testnet地址和Waves mainnet地址之间的关系

我写了这段代码片段,输入了一个酒吧钥匙和我从Waves Keeper那里得到的地址:

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`)
以下是我得到的输出:


显然,手动派生的地址是不同的。我缺少什么?

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

addressFromPublicKey(publicKey: ByteVector): Address

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

addressFromPublicKey(publicKey: ByteVector): Address