1

I try to call

web3.utils.sha3('234');

on truffle console. However I got an error:

TypeError: Cannot read property 'sha3' of undefined
at evalmachine.<anonymous>:1:11
at ContextifyScript.Script.runInContext (vm.js:35:29)
at Object.runInContext (vm.js:89:6)
at Console.interpret (C:\Users\aa\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:202201:17)
at ReplManager.interpret (C:\Users\aa\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:202917:18)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.<anonymous> (repl.js:538:10)
at emitOne (events.js:96:13)
at REPLServer.emit (events.js:188:7)

Does this mean web3.utils.sha3 has not supported yet?

1 Answer 1

5

It appears you're trying to use the web3.js 1.0 syntax of web3.utils.sha3(string) but the latest version of truffle actually uses web3 0.20.1 which has the syntax web3.sha3(string [, options]). Try that instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.