geth: shh_newIdentity no existe/no está disponible

Estoy probando susurros con web3y gethen una red de prueba privada. Solo estoy ejecutando el siguiente código tomado de Ethereum Whisper wiki .

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

Sin embargo, estoy teniendo este problema:

app.js:5318 Error no detectado: el método shh_newIdentity no existe/no está disponible

Estoy teniendo una suposición descabellada de que hay algo mal con geth. De acuerdo con este problema, el JSON RPC shh_newIdentityya debería haberse implementado. ¿Algunas ideas?

No me di cuenta de eso, pero ¡oye! ¡Primera publicación en ethereum stackexchange!

Respuestas (2)

Tendrás que empezar gethcon el --shhparámetro.

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

Sin el --shhparámetro:

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

Con el --shhparámetro:

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
¡Gracias! Solo quería agregar que, en mi caso, también necesito agregar shh a --rcpapi:--rpc --rpcport 8545 --rpcaddr 0.0.0.0 --rpccorsdomain "*" --rpcapi "db,eth,net,web3,shh"

En geth, debe especificar las banderas --shh y --rpcapi "db,eth,net,web3,shh"