Getting Started with Geth¶
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum
geth version
geth account new --datadir ./myData
gensis.json¶
{
"config": {
"chainId": 15,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"difficulty": "0x1",
"gasLimit": "8000000",
"alloc": {
"f6e00498350aca1ccf1c62947d8b31bc432a9155" : {
"balance": "888888888888888888888888" }
}
Warning
Please use the address which is generated instead of f6e00498350aca1ccf1c62947d8b31bc432a9155
geth --datadir ./myData init genesis.json
ifconfig
geth --port 3000 --networkid 5353 --datadir=./myData --rpc --rpcport 8081 --rpcaddr 172.22.6.121 --rpccorsdomain "*" --rpcapi "eth,net,web3,personal,miner" console 2>>myEth.log
eth.accounts
eth.getBalance(eth.accounts[0])
eth.coinbase
personal.newAccount("redhat")
personal.newAccount()
eth.getBalance(eth.accounts[1])
eth.getBalance(eth.accounts[2])
tail -f myEth.log
eth.coinbase
miner.setEtherbase(eth.accounts[1])
eth.coinbase
personal.unlockAccount(eth.accounts[1],"redhat",0)
miner.start()
tail -f myEth.log
miner.stop()
eth.getBalance(eth.accounts[1])
miner.setEtherbase(eth.accounts[0])
eth.getBalance(eth.accounts[0])
eth.getBalance(eth.accounts[2])
personal.unlockAccount(eth.accounts[0])
eth.sendTransaction({from:eth.accounts[0],to:eth.accounts[2],value: web3.toWei(0.05,"ether"),gas:21000});
miner.start()
miner.stop()
eth.getBalance(eth.accounts[2])