blockchain | 2018-05-04T10:00:00+05:30

An Introduction to the Genesis Block in Ethereum

Hellonext, Inc.

Hellonext Team

Very closely attributed to its name, the genesis block is the first or origin block of a private network on Ethereum. The genesis block contains all the essential information to configure the network as well as find related peers. It's basically the config file for your Ethereum network. In fact to boot up your network, you actually need to pass in the location of the file as a param.

The genesis file is a simple JSON file that contains config thresholds. Here's an example,

  "config": {
    "chainId": 15,
    "homesteadBlock": 0
  "difficulty": "1",
  "gasLimit": "9999999",
  "nonce": "0xdeadbeefdeadbeef",
  "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "alloc": {
    "7df9a875a174b3bc565e6424a0050ebc1b2d1d82": {
      "balance": "30000"
    "f41c74c9ae680c1aa78f42e5647a62f353b7bdde": {
      "balance": "40000"

Though this file is by no means comprehensive, it does contain all the params that create a good base network.

  1. config The file starts out with the "config" block which contains all the config parameters and thresholds that control the networks basic operations. Read more here.

    • chainId: Protects the network from a replay attack. It acts like a offset to prevent attackers from deciphering continuous values in your network.
    • homesteadBlock: Homestead is the second major release of Ethereum(the first release is Frontier). The value 0 means that you are using this release.
  2. difficulty This determines how difficult it is to mine in your network. When developing on a test network, set it to the lowest possible value so you don't have to wait too long for mining blocks.

  3. gasLimit This defines the limit of gas cost per block. Set this value high to avoid being limited when testing.

  4. nonce & mixhash Nonce and mixhash are values which when combines, allows to verify that a block has really been cryptographically mined, and thus is valid. The mixhash is 256-bit hash which proves, when combined with the 64-bit nonce, that a sufficient amount of computation has been carried out on this block: the Proof-of-Work (PoW).

  5. alloc Allows defining a list of pre-filled wallets. That's an Ethereum specific functionality to handle the "Ether pre-sale" period. You can also leave this as an empty hash.

There are many more parameters and configuration options you can add to the genesis block, but the ones mentioned above are the ones you'll be absolutely needing.

Now that we have the genesis block, how do you start the network? Simple. Just run the following command (make sure you have geth installed!),

geth --datadir ~/.ethereum_private init ~/dev/genesis.json
geth --fast --cache 512 --ipcpath ~/Library/Ethereum/geth.ipc --networkid 1234 --datadir ~/.ethereum_private --port "35555" console

The above commands are for the Mac OS.

These commands do a few things:

  • The first utilises the genesis file to seed the blockchain.
  • It uses the datadir to store all state necessary to maintain the newly created blockchain.
  • The second command opens up the console to that network.
  • The IPC (interprocess communication) path is the local pipe between the node and UI and is only local to your host. It becomes important when attaching a console to a running node.
  • Assign a port address to prevent the network from clashing with an already running process.

You've just started your own private Ethereum network!

Last updated: September 7th, 2023 at 7:42:06 AM GMT+0

Hellonext Blogpost Author Profile

Hellonext Team

Hellonext is a user feedback tool and this article was written by many people at Hellonext. Hellonext helps prioritize product roadmap based on user-input.