1

I am running an ethereum node remotely using a start-up shell script. The command in the shell-script is as follows:

/usr/bin/geth --testnet --rpc --rpcport "5678" --rpcaddr "0.0.0.0" --rpccorsdomain "*" || logger "Geth not running"

Now my NodeJS app in local computer has the following code:

var express = require('express');
var router = express.Router();
var Web3 = require('web3');


if (typeof web3 !== 'undefined') {
  web3 = new Web3(web3.currentProvider);
} else {
    var web3 = new Web3(new Web3.providers.HttpProvider("http://<IP>:<PORT>"));
}

var test_address = "ad9ffbd06d27d919b2f8d08c9abb5a4a90410eb1";



router.get('/', function(req, res) {
  res.render('index', { title: 'Balance' });
});

router.get('/check', function(req, res) {

  /*var coinbase = web3.eth.coinbase;
  var balance = web3.eth.getBalance(coinbase);*/

  //var balance  = /*web3.fromWei(web3.getBalance(web3.coinbase));*/ web3.eth.checkAllBalances();

  /*var coinbase = web3.eth.coinbase;*/
  //var balance = web3.eth.getBalance(test_address);      

  /*web3.eth.getCoinbase(function(error, result){ 

    if(error)
        res.send("Error: "+error);
    else
        res.send("Result: "+result);

  });*/

  var block = web3.eth.getBalance(test_address);
  console.log(block)

});

module.exports = router;

Issue 1: Whenever I try to use the coinbase method (it is commented in above code) to get balance, it just says: Error: etherbase address must be explicitly specified I have already create an account using:

geth account new

As far as I understand, the default coinbase / etherbase will always be the first account created, so I can't really understand why am I getting this error.

Issue 2:

After creating the account, I made transfer of 10000 Ether to the new account from test.ether.camp website. Whenever I check the balance of the new account from ether camp website, it shows 10000 Ether balance while the above code returns 0. Could it be that the block having the transaction information (the one I made from ether camp to my account) has not been downloaded in my node ? Or is there something wrong I am doing here?

Thanks in advance,

2

You run

geth --testnet

which tells geth to use the Ropsten testnet. However,

https://test.ether.camp/

is still running the old, deprecated Morden testnet. Use

https://ropsten.ether.camp/

to check your current balance. Read more on Ropsten and Morden.

  • I will upvote you right away sir! Also, When I make a RPC to geth running remotely, I cannot get the account list / balance of the account. It also says that the coinbase is not set. But as far as I know, isnt the coinbase supposed to be the first account created if coinbase is explicitly not defined ? If I use geth command line in the remote machine, the two accounts that I have created show up, while the RPC returns 0 accounts. Could you put some light in it? – freerunner Feb 10 '17 at 12:30
  • Oh, I forget to mention, please do not post multiple issues in one question. Just ask another one regarding your coinbase issue. – Waqar Lim Feb 10 '17 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.