Estoy probando susurros con web3
y geth
en 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_newIdentity
ya debería haberse implementado. ¿Algunas ideas?
Tendrás que empezar geth
con el --shh
parámetro.
user@Kumquat:~$ geth help | grep shh
--shh Enable Whisper
Sin el --shh
pará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 --shh
pará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
--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"
Hoang largo