#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!!!

#StackBounty: #solidity #go-ethereum #string Send request failed { code: -32602, message: 'invalid argument 0: json: cannot unmarsh…

Bounty: 50

I am new to ethereum and deploying my first contract with simple method getting following error:

[2018-03-24 11:08:14.364] [ERROR] ipcProviderBackend - Send request failed { code: -32602,
  message: 'invalid argument 0: json: cannot unmarshal non-string into Go value of type common.Hash' }

Following is the contract method in solidity that i am calling:

function testContract(string title,string _description,
                           address _contractAddressOfAsset,
                           string _recordIdOfAsset,
                           uint _deadline,
                           uint _startingPrice,
                           uint _reservePrice,
                           uint _distributionCut,
                           address _distributionCutAddress) public returns (bool k) {


        test=title;
        return true;
    }

Here ,
test is the global variable of type string.

Note: I have deployed this contract in the private network and this contract from the mist browser

Following are the version details of geth:

Geth
Version: 1.7.3-stable
Git Commit: 4bb3c89d44e372e6a9ab85a8be0c9345265c763a
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.9
Operating System: linux
GOPATH=
GOROOT=/usr/lib/go-1.9


Get this bounty!!!

#StackBounty: #solidity #go-ethereum #string Send request failed { code: -32602, message: 'invalid argument 0: json: cannot unmarsh…

Bounty: 50

I am new to ethereum and deploying my first contract with simple method getting following error:

[2018-03-24 11:08:14.364] [ERROR] ipcProviderBackend - Send request failed { code: -32602,
  message: 'invalid argument 0: json: cannot unmarshal non-string into Go value of type common.Hash' }

Following is the contract method in solidity that i am calling:

function testContract(string title,string _description,
                           address _contractAddressOfAsset,
                           string _recordIdOfAsset,
                           uint _deadline,
                           uint _startingPrice,
                           uint _reservePrice,
                           uint _distributionCut,
                           address _distributionCutAddress) public returns (bool k) {


        test=title;
        return true;
    }

Here ,
test is the global variable of type string.

Note: I have deployed this contract in the private network and this contract from the mist browser

Following are the version details of geth:

Geth
Version: 1.7.3-stable
Git Commit: 4bb3c89d44e372e6a9ab85a8be0c9345265c763a
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.9
Operating System: linux
GOPATH=
GOROOT=/usr/lib/go-1.9


Get this bounty!!!

#StackBounty: #solidity #go-ethereum #string Send request failed { code: -32602, message: 'invalid argument 0: json: cannot unmarsh…

Bounty: 50

I am new to ethereum and deploying my first contract with simple method getting following error:

[2018-03-24 11:08:14.364] [ERROR] ipcProviderBackend - Send request failed { code: -32602,
  message: 'invalid argument 0: json: cannot unmarshal non-string into Go value of type common.Hash' }

Following is the contract method in solidity that i am calling:

function testContract(string title,string _description,
                           address _contractAddressOfAsset,
                           string _recordIdOfAsset,
                           uint _deadline,
                           uint _startingPrice,
                           uint _reservePrice,
                           uint _distributionCut,
                           address _distributionCutAddress) public returns (bool k) {


        test=title;
        return true;
    }

Here ,
test is the global variable of type string.

Note: I have deployed this contract in the private network and this contract from the mist browser

Following are the version details of geth:

Geth
Version: 1.7.3-stable
Git Commit: 4bb3c89d44e372e6a9ab85a8be0c9345265c763a
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.9
Operating System: linux
GOPATH=
GOROOT=/usr/lib/go-1.9


Get this bounty!!!