Basicly I'm doing the beginners tutorial and it should show this

With coinbase adress

But For me it just does this

Without adresses

How can I make web3.eth.coinbase refer to my adress? Do I have to run a node or test-net?

<script type="text/javascript">
///First web3.eth.watch code to monitor coinbase

  var coinbase = web3.eth.coinbase;
  document.getElementById('coinbase').innerText = coinbase;
  var balance = web3.eth.balanceAt(coinbase);
  document.getElementById('balance').innerText = web3.toDecimal(balance);

///Insert your contract address var here:

///Second web3.eth.watch code to monitor block number

  • Tell us a bit more about your setup and the exact tutorial that you're following. If you're working with the go-to Ethereum client (geth) then you can start the JavaScript console and set it via web3.eth.coinbase=web3.eth.accounts[0] (or whatever account you choose). – SCBuergel Mar 10 '17 at 23:57
  • I was doing this tutorial dappsforbeginners.wordpress.com/tutorials/javascript-api-1 and I just typed it into the sublimeText editor. – bhikkhu Mar 11 '17 at 0:52
  • I added the code that I used – bhikkhu Mar 11 '17 at 1:30
  • That is an incredibly out-of-date tutorial, unfortunately. Even if you were to connect a node, that version of web3 is long deprecated. Here is a more modern tutorial, from the official Ethereum Foundation website. – Matthew Schmidt Mar 11 '17 at 13:22

In Geth CLI, you can set your coinbase as follows:


Edit: For web3, it is web3.miner.setEtherbase("0x123...");


what do you get when you go into the JS Console of your local geth node and type in the following?


and what do you get when you put in


This way you could check if your node has a properly configured coinbase. The second command should output your default or primary account. Using:


will output all available accounts.

Personally I use:


to define my coinbase both in the JS Node as well as in web3.

I assume that within your HTML you point to web3.js?


I'm kinda new at this myself, but.....this gives you some practical guide lines into commands to get you started. have you run "geth account new"? that will attach a coinbase account to your mining operation.


  • Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Afr Mar 14 '17 at 12:36
  • 1
    gottcha....new to forums in general and this one specifically....but huge amounts of good info here. – GTRrunsOnETH Mar 15 '17 at 19:44

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.