0

我尝试了ethereumjs-utilreact-native首先ethUtil.privateToPublic工作正常,然后在使用时ethUtil.publicToAddress会收到此错误TypeError: Cannot read property 'call' of undefined,我跟踪错误实际上来自Keccak

然后我自己尝试Keccak

const createKeccakHash = require('keccak');
console.log(createKeccakHash('keccak256').digest().toString('hex'));

也得到同样的错误TypeError: Cannot read property 'call' of undefined

4

1 回答 1

1

你可以尝试使用js-sha3我知道可能你的模块不支持React Native.

keccak256 = require('js-sha3').keccak256;
var bytes = keccak256.digest();
console.log(bytes);
于 2019-08-18T12:40:23.520 回答