Ethereum Private Chain - norchain/learning GitHub Wiki
Setup Private Chain
Follow this Tutorial
- Recompile geth with bootnode. (Could be another way to assign the bootnode by CLI. But not sure yet)
How to join the private chain
- Get the recompiled geth, put it to
my_path
. - Paste the
genesis.json
provided by the chain generator tomy_path
- mkdir
my_path/chaindata
- Go to
my_path
, run./geth --datadir ./chaindata init ./genesis.json
- Run
./geth --datadir ./chaindata/ --networkid {chainId in genesis.json} console
- Wait for the node to connect with other nodes. Be patient, it can take more than 10min.
- If you want a new console window without logs, launch a new terminal, cd the same path, then
geth attach ipc:chaindata/geth.ipc
Common console operations
- Generate new account:
personal.newAccount()
. Create new account:geth account new
. More methods see HERE - Check accounts:
eth.accounts
- Check main account:
eth.coinbase
- Mine:
miner.start() miner.stop()
- Check Balance:
web3.fromWei(eth.getBalance(eth.coinbase), "ether")
. Not considering decimal, can simply useeth.getBalance({account})
Smart Contract
- De
Other operations
- Stop geth in terminal: the best way is to open another terminal, then run
killall -HUP geth