Hey it's been a while...
I have been doing a lot of learning in the blockchain space and I recently learnt about the genesis.json file, so i'm back here to share my learnings with you guys. If you are someone who is curious about the web3 space, i hope you find this post useful.
The Genesis.json file is a config file for Go-Ethereum (a blockchain node), that is needed in order to create a private blockchain network. It is the file that Go-Ethereum needs to create the very first block (Genesis block) of your private network.
ChainId: This can be set to any number except 1, 2 and 3, because 1 is reserved for the Mainnet while 2 & 3 is reserved for the Testnets.
Homesteadblock: Ethereum is separated into certain releases, the previous one was Frontier network launched on July 30th, 2015 and next release was called the Homestead launched on Mar-14-2016. It is usaually set to zero (0) in the Genesis.json file.
eip155Block: eip stands for Ethereum improvement protocol. It is usually set to zero (0) in the Genesis.json file.
Difficulty: This is very important if you want to mine ether on your network or create contracts. The lower it is, the faster mining will be, the easier it will be for your miner to solve the mathematical riddle in order to mine blocks. If you realize that mining takes too long, you can initialize
a new private network and set the difficulty lower.
GasLimit: This is necessary for deploying contracts, each contract written in solidity will be compiled to something like assembly or byte code. And each of them takes up some gas. The GasLimit is here to limit the amount of logic that you can run on a miner. The higher the GasLimit, the more complex your contracts can get. The current GasLimit on the Ethereum network is around 6 million or even more.
Alloc: This is set to pre-allocate ether to certain accounts.
When you initialize your private network you might want to allocate ether to some accounts and this is where you set those accounts before initializing your private network.
That's it for this post guy's, I hope I've been able to at least give you an idea about what the Genesis.json file is and why this space is so interesting.
Keep building, catch you later!