#StackBounty: #go-ethereum #whisper How to send 1-N signalling or broadcast messages on Whisper?

Bounty: 50

From Whisper wiki:

Low-latency, 1-1 or 1-N signalling messages.

Shh.post(self, message:) and Whisper Usage / shh.post

Creates a whisper message and injects it into the network for
distribution.

Example usage of web3.shh.post, for more details please see this answer:

web3.shh.post({
  pubKey: 'PUBLIC_KEY_OF_THE_RECEIVER',
  ttl: 3600,
  topic: '0x07678231',
  powTarget: 2.01,
  powTime: 2,
  payload: web3.fromAscii("Hello there!")
  });

When I remove pubKey from web3.shh.post as arguments; it says: Error: specify either a symmetric or an asymmetric key.

shh.post({ "topic": t, "payload": p }); No signature, no encryption: Anonymous broadcast; a bit like an anonymous subject-filtered twitter feed.

[Q] Since web3.shh.post()requires us to provide single public key of the receiver; is it possible to send 1-N or broadcast message using whisper protocol? If yes, how?


Get this bounty!!!

#StackBounty: #go-ethereum #whisper How to send 1-N signalling messages on Whisper?

Bounty: 50

From Whisper wiki:

Low-latency, 1-1 or 1-N signalling messages.

Shh.post(self, message:)

Creates a whisper message and injects it into the network for
distribution.

Example usage of web3.shh.post, for more details please see this answer:

web3.shh.post({
  pubKey: 'PUBLIC_KEY_OF_THE_RECEIVER',
  ttl: 3600,
  topic: '0x07678231',
  powTarget: 2.01,
  powTime: 2,
  payload: web3.fromAscii("Hello there!")
  });

When I remove pubKey from web3.shh.post as arguments; it says: Error: specify either a symmetric or an asymmetric key. Whisper overview is out of date. It gives following example as use case which does not work:

shh.post({ "topic": t, "payload": p }); No signature, no encryption: Anonymous broadcast; a bit like an anonymous subject-filtered twitter feed.

[Q] Since web3.shh.post()requires us to provide single public key of the receiver; is it possible to send 1-N message using whisper protocol? If yes, how?


Get this bounty!!!

#StackBounty: #go-ethereum #whisper Whisper: How could we print received messages that are actually stored in the memory when geth was …

Bounty: 50

Whisper Protocol is not well documented related to its usage. I believe this issue will help other users who might face with similar problem.

Each sent message has time-to-live in seconds (ttl), that is defined by the sender. For more detail please see Whisper v5 RPC API => shh_post. Whisper Protocol keeps received messages in the memory until messages’ time-to-live time is over, when geth was closed or shh.newMessageFilter() is not activated.

=> How could we access and print those received messages that are actually stored in the memory?


Whisper v5 RPC API:

shh_getFilterMessages

Retrieve messages that match the filter criteria and are received
between the last time this function was called and now.

  • But there is no getFilterMessages() method with the latest shh. Please see.

On this solution; we can use same key pairs after geth is restarted. But the issue after geth is restarted and later when we run shh.newMessageFilter(); it does not retrieve/return any message that was sent while geth was closed.

[Q] How could we obtain/filter messages that sent when geth was closed or shh.newMessageFilter() is not activated?. When we run web3.shh.newMessageFilter(), it only retrieves/filters messages right after it start running and it does not filter/print any message before it starts running.

Example Scenario:

=> On the receiver node I closed geth and from the sender node, I have sent multiple messages into receiver node. Later, when I reopened geth on the receiver node, shh.info.memory verifies that there are received messages in memory, but I was not able to retrieve/filter those messages using web3.shh.newMessageFilter().

> shh.info.memory
780

Here is some logs:

Creating web3.shh.newMessageFilter():

> kId=shh.addPrivateKey('0x8de0b39f3a4a109f27bb06a92dab680d58e8f029eaca61da6be7115981a2ed11')
"439bfd6aa63a81b404ba20e4fc250e11c326d72ad9943c72dc445f476638989d"

> filter=web3.shh.newMessageFilter(
...         {privateKeyID:kId},
...         function(err, res) {console.log(web3.toUtf8(res.payload))});
{
  callbacks: [function(err, res)],
  filterId: "a0b4194651c9143d977c2fa4848ab681b414720364461b4096fb17588d84ae78",
  formatter: null,
  getLogsCallbacks: [],
  implementation: {
    getLogs: function(),
    newFilter: function(),
    poll: function(),
    uninstallFilter: function()
  },
  options: {
    privateKeyID: "439bfd6aa63a81b404ba20e4fc250e11c326d72ad9943c72dc445f476638989d"
  },
  pollFilters: [],
  requestManager: {
    polls: {
      82f08d2d7fe974a69acdadcfac39f788575d337eed9577969b617ae28462e597: {
        data: {...},
        id: "82f08d2d7fe974a69acdadcfac39f788575d337eed9577969b617ae28462e597",
        callback: function(error, messages),
        uninstall: function()
      },
      a0b4194651c9143d977c2fa4848ab681b414720364461b4096fb17588d84ae78: {
        data: {...},
        id: "a0b4194651c9143d977c2fa4848ab681b414720364461b4096fb17588d84ae78",
        callback: function(error, messages),
        uninstall: function()
      }
    },
    provider: {
      newAccount: function(),
      openWallet: function(),
      send: function github.com/ethereum/go-ethereum/console.(*bridge).Send-fm(),
      sendAsync: function github.com/ethereum/go-ethereum/console.(*bridge).Send-fm(),
      sign: function(),
      unlockAccount: function()
    },
    timeout: {},
    poll: function(),
    reset: function(keepIsSyncing),
    send: function(data),
    sendAsync: function(data, callback),
    sendBatch: function(data, callback),
    setProvider: function(p),
    startPolling: function(data, pollId, callback, uninstall),
    stopPolling: function(pollId)
  },
  get: function(callback),
  stopWatching: function(callback),
  watch: function(callback)
}

I can see shh_getFilterMessages under filter.requestManager.polls but I cannot call it.

> filter.requestManager.polls
{
  82f08d2d7fe974a69acdadcfac39f788575d337eed9577969b617ae28462e597: {
    data: {
      method: "shh_getFilterMessages",
      params: ["82f08d2d7fe974a69acdadcfac39f788575d337eed9577969b617ae28462e597"]
    },
    id: "82f08d2d7fe974a69acdadcfac39f788575d337eed9577969b617ae28462e597",
    callback: function(error, messages),
    uninstall: function()
  },
  a0b4194651c9143d977c2fa4848ab681b414720364461b4096fb17588d84ae78: {
    data: {
      method: "shh_getFilterMessages",
      params: ["a0b4194651c9143d977c2fa4848ab681b414720364461b4096fb17588d84ae78"]
    },
    id: "a0b4194651c9143d977c2fa4848ab681b414720364461b4096fb17588d84ae78",
    callback: function(error, messages),
    uninstall: function()
  }
}

> a.requestManager.polls.82f08d2d7fe974a69acdadcfac39f788575d337eed9577969b617ae28462e597
(anonymous): Line 1:23 Unexpected token ILLEGAL


Get this bounty!!!

#StackBounty: #go-ethereum #web3js #whisper #rpc web3.js: Error: The method shh_newSymKey does not exist/is not available on Web3.js

Bounty: 50

My main goal is to call web3.shh functions using RPC API , Web3.py or Web3.js. I can call web3.shh functions when I use geth attach; which is my last option to do.

I am following this answer.

  • geth version: 1.8.0-unstable
  • I am running geth with --shh flag.

  • console.log(web3.version); returns: api: '0.20.5'.

When I run following script:

Web3 = require("web3");
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

if(!web3.isConnected()){ //web3@0.20.5
//if(!web3.eth.net.isListening().then(console.log)){ //web3@1.0.0-beta.34
    console.log("notconnected");
    process.exit();
}

var kId = web3.shh.newSymKey(); //Error occurs. 

var kId = web3.shh.newSymKey(); gives following error with web3@'0.20.5':

Error: The method shh_newSymKey does not exist/is not available
    at Object.InvalidResponse (/home/alper/eBlocBroker/node_modules/web3/lib/web3/errors.js:38:16)
    at RequestManager.send (/home/alper/eBlocBroker/node_modules/web3/lib/web3/requestmanager.js:61:22)
    at Shh.send [as newSymKey] (/home/alper/eBlocBroker/node_modules/web3/lib/web3/method.js:145:58)
    at Object.<anonymous> (/home/alper/eBlocBroker/dd.js:9:20)
    at Module._compile (module.js:649:30)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Function.Module.runMain (module.js:690:10)

Please note that I have tried it with web3@1.0.0-beta.34 that also gives this error that seems like the same error:

Promise { <pending> }
true
(node:16162) UnhandledPromiseRejectionWarning: Error: Returned error: The method shh_newSymKey does not exist/is not available
    at Object.ErrorResponse (/home/alper/eBlocBroker/node_modules/web3-shh/node_modules/web3-core-helpers/src/errors.js:29:16)
    at /home/alper/eBlocBroker/node_modules/web3-shh/node_modules/web3-core-requestmanager/src/index.js:140:36
    at XMLHttpRequest.request.onreadystatechange (/home/alper/eBlocBroker/node_modules/web3/node_modules/web3-providers-http/src/index.js:77:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/home/alper/eBlocBroker/node_modules/xhr2/lib/xhr2.js:64:18)
    at XMLHttpRequest._setReadyState (/home/alper/eBlocBroker/node_modules/xhr2/lib/xhr2.js:354:12)
    at XMLHttpRequest._onHttpResponseEnd (/home/alper/eBlocBroker/node_modules/xhr2/lib/xhr2.js:509:12)
    at IncomingMessage.<anonymous> (/home/alper/eBlocBroker/node_modules/xhr2/lib/xhr2.js:469:24)
    at IncomingMessage.emit (events.js:185:15)
    at endReadableNT (_stream_readable.js:1101:12)
    at process._tickCallback (internal/process/next_tick.js:114:19)
(node:16162) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:16162) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

[Q] How could I fix this error? What do I do wrong?

Please note that available shh functions could be seen here; output of console.log(web3.shh).


Further Investigation:

I have tried to use Whisper v5 RPC API ; I was not able to figure out how to do curl request using curl -X POST --data '{...}'. Error I am receiving is curl: no URL specified!.

=> How could I also make RPC API work?


Get this bounty!!!

#StackBounty: #go-ethereum #web3js #whisper #rpc web3.js: Error: The method shh_newSymKey does not exist/is not available

Bounty: 50

My main goal is to call web3.shh functions using RPC API , web3.py or web3.js. I can call web3.shh functions when I use geth attach; which is my last option.

I am following this answer.

  • geth version: 1.8.0-unstable-e7610ead
  • I am running geth with --shh flag.

  • console.log(web3.version); returns: api: '0.20.5'.

When I run following script:

Web3 = require("web3");
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

if(!web3.isConnected()){ //web3@0.20.5
//if(!web3.eth.net.isListening().then(console.log)){ //web3@1.0.0-beta.34
    console.log("notconnected");
    process.exit();
}

var kId = web3.shh.newSymKey(); //Error occurs. 

var kId = web3.shh.newSymKey(); gives following error with web3@'0.20.5':

Error: The method shh_newSymKey does not exist/is not available
    at Object.InvalidResponse (/home/alper/eBlocBroker/node_modules/web3/lib/web3/errors.js:38:16)
    at RequestManager.send (/home/alper/eBlocBroker/node_modules/web3/lib/web3/requestmanager.js:61:22)
    at Shh.send [as newSymKey] (/home/alper/eBlocBroker/node_modules/web3/lib/web3/method.js:145:58)
    at Object.<anonymous> (/home/alper/eBlocBroker/dd.js:9:20)
    at Module._compile (module.js:649:30)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Function.Module.runMain (module.js:690:10)

Please note that I have tried it with 1.0.0-beta.34 that also gives this error that seems like the same error:

Promise { <pending> }
true
(node:16162) UnhandledPromiseRejectionWarning: Error: Returned error: The method shh_newSymKey does not exist/is not available
    at Object.ErrorResponse (/home/alper/eBlocBroker/node_modules/web3-shh/node_modules/web3-core-helpers/src/errors.js:29:16)
    at /home/alper/eBlocBroker/node_modules/web3-shh/node_modules/web3-core-requestmanager/src/index.js:140:36
    at XMLHttpRequest.request.onreadystatechange (/home/alper/eBlocBroker/node_modules/web3/node_modules/web3-providers-http/src/index.js:77:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/home/alper/eBlocBroker/node_modules/xhr2/lib/xhr2.js:64:18)
    at XMLHttpRequest._setReadyState (/home/alper/eBlocBroker/node_modules/xhr2/lib/xhr2.js:354:12)
    at XMLHttpRequest._onHttpResponseEnd (/home/alper/eBlocBroker/node_modules/xhr2/lib/xhr2.js:509:12)
    at IncomingMessage.<anonymous> (/home/alper/eBlocBroker/node_modules/xhr2/lib/xhr2.js:469:24)
    at IncomingMessage.emit (events.js:185:15)
    at endReadableNT (_stream_readable.js:1101:12)
    at process._tickCallback (internal/process/next_tick.js:114:19)
(node:16162) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:16162) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

[Q] How could I fix this error? What do I do wrong?

Please note that available shh functions could be seen here; output of `console.log(web3.shh)’.


Further Investigation:

I have tried to use Whisper v5 RPC API ; I was not able to figure out how to do curl request using curl -X POST --data '{...}'. Error I am receiving is curl: no URL specified!. How could I make RPC API work?


Get this bounty!!!

#StackBounty: #go-ethereum #mining geth 1.8.8 miner hashrate 0 after join network where major miners ran on older version

Bounty: 50

I am planning to upgrade my miners from 1.7.x to 1.8.x.

For testing purpose, I make a copy of geth data and then run a new version of geth miner against a copied data. After the new miner finished DAG generation. I waited to see the Hashrate of the new miner. Unfortunately, the new miner hashrate is always zero.

Did I do something wrong?


Get this bounty!!!

#StackBounty: #go-ethereum #web3js #events #websocket Healtcheck on Websocket

Bounty: 50

I’ve looked through the documentation and haven’t found that to be helpful.

I would like to know the best way to do a healthcheck on my websocket connection to geth (Yesterday, I found out that I did not receive the new event from a few days ago without any reason).

I have a solution but it is not likely the best practice approach.

const web3 = new Web3(new Web3.providers.WebsocketProvider(networkUri));

setInterval(() => {
  console.log('Check WS status');
  let subscription;
  new Promise((resolve, reject) => {
    subscription = web3.eth.subscribe('pendingTransactions')
      .on('data', function () {
        return resolve(true);
      })
      .on('error', function () {
        return reject(false);
      });
  })
    .then(() => {
      console.log('OK');
    })
    .catch(() => {
      console.log('NOK');
      reconnect();
    })
    .finally(() => {
      // unsubscribes the subscription
      subscription.unsubscribe(function (error, success) {
        if (success)
          console.log('Successfully unsubscribed!');
      });
    })
}, 30000);

Regards


Get this bounty!!!

#StackBounty: #go-ethereum #web3js #events #websocket #healthcheck Healtcheck on Websocket

Bounty: 50

I try to find that in the documentation but no success..

I would like to know the best way to do an healthcheck on my websocket connection to geth (Yesterday, I discover that I did not receive the new event since few days without any reason).

I did a custom stuff but I don’t think this a best practice :/

const web3 = new Web3(new Web3.providers.WebsocketProvider(networkUri));

setInterval(() => {
  console.log('Check WS status');
  let subscription;
  new Promise((resolve, reject) => {
    subscription = web3.eth.subscribe('pendingTransactions')
      .on('data', function () {
        return resolve(true);
      })
      .on('error', function () {
        return reject(false);
      });
  })
    .then(() => {
      console.log('OK');
    })
    .catch(() => {
      console.log('NOK');
      reconnect();
    })
    .finally(() => {
      // unsubscribes the subscription
      subscription.unsubscribe(function (error, success) {
        if (success)
          console.log('Successfully unsubscribed!');
      });
    })
}, 30000);

Regards


Get this bounty!!!

#StackBounty: #go-ethereum #web3js web3.eth.subscribe not working?

Bounty: 50

Running geth with websocket:

geth --fast --cache=512 --ws --wsorigins="*" --wsapi "db,eth,net,ssh,miner,web3,personal,admin"

Then connecting with web3 in a Node.js app:

const Web3 = require('web3');

var web3 = new Web3(new Web3.providers.WebsocketProvider("ws://localhost:8546"));

console.log(web3.version);

web3.eth.subscribe('pendingTransactions', function(err, res) {
    console.log('Here')
    console.log(err)
    console.log(res)
}).on('data', function(transaction) {
    console.log('Here 2')
    console.log(transaction)
});

“Here”, “Here 2” do not print to the console. The subscription does not seem to activate. web3.version and other web3 commands work fine.


Geth version: 1.7.1-stable

Web3 version: 1.0.0-beta.22


Get this bounty!!!

#StackBounty: #go-ethereum #mining #coinbase how do i cash out mined ethereum?

Bounty: 50

I’ved tried my luck on ethereum mining with this https://github.com/angelomilan/ethereum-guides/blob/master/GPU-cloud_mining.md
And I think I have some ethereum.

> eth.getBalance(eth.coinbase).toNumber();
5000000000000000000
> web3.fromWei(eth.getBalance(eth.coinbase), "ether")
5

UPDATE:
I tried to send using this but has this error:

eth.sendTransaction({from:eth.accounts[0], to:"0x21389ab987979ae987", value: web3.toWei(0.0005, "ether"), gas:5000})

Error: intrinsic gas too low


> eth.getBlock("latest").gasLimit
5003

> net.peerCount
0

What is intrinsic gas too low and how to solve this, my gasLimit is 5003. What is all this and how to I would say pump more gas ?

My question is now how do I convert it to cash ? I cant figure that out. I believe on the .ethereum hidden folder contains the coinbase wallet. How do I then cash it out ?


Get this bounty!!!