Geth Console
You can connect to and run commands on a node on the Devent using the geth console.
You can start the console and connect to the node through any one of the http, ws or ipc ports using one of the following commands (use the IP and port for the node you want to connect to):
geth attach http://127.0.0.1:8545
geth attach ws://127.0.0.1:8546
geth attach geth.ipc (run this in the [working directory]/execution directory)
Commands
There are several commands you can run to get data from the node, a few common ones are listed below. You can find the rest from the documentation.
- To see the current block number (if your nodes are all mining and syncing this should increase at regular intervals and should be the same on all nodes):
eth.blockNumber
- To see a list of accounts:
eth.accounts
- To see the balance in an account in the default denomination (wei):
eth.getBalance(eth.accounts[0])
- To see the balance in an account in the another denomination (say ether):
web3.fromWei(eth.getBalance(eth.accounts[0]), 'ether')
- To send ether from one account to another (in wei):
eth.sendTransaction({to:'[account_address]', from: eth.accounts[0], value:25000 });
- To send ether from one account to another (in ether):
web3.eth.sendTransaction({from:"[account_address]", to:"[account_address]", value: web3.toWei(0.1, "ether") })