I trying the ethereumjs-util
in react-native
, first ethUtil.privateToPublic
work fine, then when use ethUtil.publicToAddress
will getting this error TypeError: Cannot read property 'call' of undefined
, I trace the error actually come from Keccak
.
Then I try Keccak it self :
const createKeccakHash = require('keccak');
console.log(createKeccakHash('keccak256').digest().toString('hex'));
also getting the same error TypeError: Cannot read property 'call' of undefined
You can try use js-sha3
I know that it maybe your module doesn't support React Native.
keccak256 = require('js-sha3').keccak256;
var bytes = keccak256.digest();
console.log(bytes);