My goal is to send a message from one ethereum node to another one. In order to accomplish it, I have followed this answer that uses Whisper Protocol.
In summary approach I followed from the linked answer above:
On the receiver node:
> var kId = web3.shh.newKeyPair(); > web3.shh.newMessageFilter( {privateKeyID:kId}, function(err, res) {console.log(JSON.stringify(res))}); > web3.shh.getPublicKey(kId) //returns PUBLIC_KEY_OF_THE_RECEIVER
On the sender node:
web3.shh.post({ pubKey: 'PUBLIC_KEY_OF_THE_RECEIVER', ttl: 7, topic: '0x07678231', powTarget: 2.01, powTime: 2, payload: web3.fromAscii("Hello there!") });
But I obtain following message on my receiver node and I do not see Hello there!
string.
{"hash":"0x0585a4c5c9d939fd8fd2861294c06185f6567530d05e3f10207c1317b1f59658",
"padding":"0x448c2c6829f2b32010bd3d821fa11046d36bb24377c511ba8dfa1672d8b43b458bbbcd437dbb603b9034be01d6b735fee3658dd0d27a2cfcbc8ef10d27829cbd0b76274b2520a9c5036801fb6b30dde0a935fd40bfa293c150405eceb5aa158729452f9f7dca28670752b34bfd6b8fe2a18bf151f0c54273145f4c334294ba0bb56f9c48495d641ee69ae3d5dc8b269de660d60362aacd700d9f11b050ccc392f9b95c3f8c56b8e9efbdfde48092f8e363fe0e486f1dac1beb263d1cb8f913c5ae8339201a9fd0605fd490890817250920d4da82884f2aa44160fb539ea44a8dd6f8af25969a66d414a7c555d4e3703510e1",
"payload":"0x48656c6c6f20746865726521",
"pow":96.02344322344322,
"recipientPublicKey":"0x04f0d4a00e0935e7b79866e2efd184a2552fadf713dc13507720399cb99a842a6fdef02055f01ae5253fc5b2a0eea9e8acad1092d9384ba57755af07949b4007fa",
"timestamp":1529434469,
"topic":"0x07678231",
"ttl":7
}
I guess payload contains the sent string. "payload":"0x48656c6c6f20746865726521"
.
[Q] Is there any way to decode this message to obtain the original sent message?