I was looking to develop an application using Whisper & NodeJS and I'm having trouble finding an example that works and is updated.
I've encountered this doc web3js.readthedocs.io/en/1.0/web3-shh.html and this guide https://github.com/ethereum/wiki/wiki/Whisper-Overview, but they are incompatible with each other ( probably version thing).
I've managed to get this far, in what I think should publish a message on Whisper, but I don't know why isn't working nor how to listen to it.
var net = require('net');
var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.IpcProvider('/Users/tloriato/Library/Ethereum/geth.ipc', net));
var KeyID;
var PubKey;
var message = web3.utils.toHex("Test");
web3.shh.newKeyPair().then((data) => {
console.log(data);
web3.shh.getPublicKey(KeyID).then((data) => {
console.log(data);
}).then(() => {
shh.post({
pubKey: PubKey,
sig: KeyID,
ttl: 120,
payload: message,
powTime: 2,
powTarget: 1
}, function(err, data){
if (err) console.log(err);
console.log(data);
});
});
});
[Q]: Does anybody has a working example for whisper working with the recent version of geth or partiy?