You are on page 1of 1

Geth Terminal

1.Intialize geth into chaindata to get the key stores

geth --datadir chaindata init genesis.json

run geth:
geth --datadir=./chaindata/

3. Open new Terminal and run below command to interact with Geth
IPC to interact with Geth:
geth attach ipc:\\.\pipe\geth.ipc

Mining
-------------
personal.newAccount() //new will be created
eth.accounts //Get ether accounts
eth.coinbase
eth.getBalance(eth.accounts[0])
miner.start()// to start the mining
miner.stop() //after mining you can observ the rewards
eth.blockNumber // to get the block number
personal.unlockAccount(eth.accounts[0]) //enter the password the one used while
creating

Run below commnad to create 2nd account


personal.newAccount() //new will be created
eth.accounts //Get ether accounts
eth.coinbase
eth.getBalance(eth.accounts[0])

Transaction:
------------
eth.sendTransaction({from: eth.coinbase, to: eth.accounts[1], value: web3.toWei(10,
"ether")})
(start mining and stop)
miner.start()// to start the mining
miner.stop() //after mining you can observ the rewards

//to chekc the Has value


eth.getTransaction(txHash)

//to chekc the Balance of second account


web3.fromWei(eth.getBalance(eth.accounts[1]), "ether")

//to get the latest Block


eth.getBlock("latest")

//To know
eth.getBlock(388)

You might also like