9

I'm trying out whispers with web3 and geth on a private testnet. I'm just running the following code taken from Ethereum Whisper wiki.

function sendWhisper() {
    var shh = web3.shh;
    var appName = "My silly app!";
    var myName = "Gav Would";
    var myIdentity = shh.newIdentity();
}

However, I'm getting this problem:

app.js:5318 Uncaught Error: The method shh_newIdentity does not exist/is not available

I'm having a wild guess that there is something wrong with geth. According to this issue the JSON RPC shh_newIdentity, should have been implemented already. Any ideas?

  • Didn't notice that, but hey! First post on ethereum stackexchange! – Long Hoang Oct 1 '16 at 15:33
6

You will have to start geth with the --shh parameter.

user@Kumquat:~$ geth help | grep shh
--shh      Enable Whisper

Without the --shh parameter:

user@Kumquat:/tmp$ geth --datadir test console
...
>   var shh = web3.shh;
undefined
>   var appName = "My silly app!";
undefined
>   var myName = "Gav Would";
undefined
>   var myIdentity = shh.newIdentity();
The method shh_newIdentity does not exist/is not available
    at web3.js:3119:20
    at web3.js:6023:15
    at web3.js:4995:36
    at <anonymous>:1:20

With the --shh parameter:

user@Kumquat:/tmp$ geth --datadir test --shh console
>   var shh = web3.shh;
undefined
>   var appName = "My silly app!";
undefined
>   var myName = "Gav Would";
undefined
>   var myIdentity = shh.newIdentity();
undefined
| improve this answer | |
0

In geth you need to specify the flags --shh and --rpcapi "db,eth,net,web3,shh"

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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