Beginners guide to Ethereum (3) — explain the genesis file and use it to customize your blockchain


Important Notes before you start

What is a genesis file

{"config": {"chainId": 15, "homesteadBlock": 0,"eip155Block": 0,"eip158Block": 0},"difficulty": "20","gasLimit": "2100000","alloc": {"7df9a875a174b3bc565e6424a0050ebc1b2d1d82": 
{ "balance": "300000" },
{ "balance": "400000" }

Start coding!

cat > genesis.json
geth init genesis.json --datadir test
geth --helpgeth init --help // the two output is different
geth --networkid 123 --datadir test console 
// remember the datadir has to be the same
// you can also use arbitrary address as long as there are 40 digits

Wrap up



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
李婷婷 Lee Ting Ting

Founder of Z Institute | Blockchain dev & security audit | Berkeley Blockchain Lab | HKUST | IG: tinaaaaalee | Github: tina1998612