I'm running Metamask on Chrome.
When I run the following in the developer console on a random page or even Etherdelta Metamask prompts me to sign a message and this is the expected behaviour.
web3.personal.sign('0x68656c6c6f', web3.eth.accounts[0], console.log)
However, when I try to run the same in the dev console on the basic Dapp created by $ truffle init webpack
I get an error saying:
Uncaught TypeError: web3.personal.sign is not a function
web3.personal does not have a function "sign" but has only ["_requestManager", "newAccount", "unlockAccount", "sendTransaction", "lockAccount", "listAccounts", "getListAccounts"]
on the truffle dapp but has the following on other sites ["_requestManager", "newAccount", "importRawKey", "unlockAccount", "ecRecover", "sign", "sendTransaction", "lockAccount", "listAccounts", "getListAccounts"]
.
Note: web3.eth.sign(web3.eth.coinbase, '0x68656c6c6f', console.log)
still works though.
Why is this happening?
Steps to reproduce the issue:
Create the basic truffle dapp by running the following commands:
- truffle init webpack
- truffle compile
- truffle migrate
- npm run dev
Open http://127.0.0.1:8081 in Chrome
- Run
web3.personal.sign('0x68656c6c6f', web3.eth.accounts[0], console.log)
in the dev console.