Genesis Block – Is the Genesis Block the Same as the First Block?

genesisprivate-blockchain

I am playing around with a private blockchain, and I realize that I don't understand how the "genesis block" is different fromthe first block. I assume it has to get mined like any other, yes? Otherwise, why have a "gasLimit" in the genesis section of a chain spec?

Is it simply the first transaction I manually engage in? Like, if I fire up a few nodes and transfer some testETH between them, is that exchange the "genesis block"?

I have to ask this because the block does not seem to automatically happen if there are no transactions. I do have a miner on the network from the moment I start Parity but until I transact something, no blocks are visible in the explorer I am running.

Best Answer

I think it's mostly a nomenclature debate. I think the Bitcoin wiki sums it up pretty well (and it's the same case with Ethereum, at least in terms of naming):

A genesis block is the first block of a block chain. Modern versions of Bitcoin (or Ethereum) number it as block 0, though very early versions counted it as block 1. The genesis block is almost always hardcoded into the software of the applications that utilize its block chain. It is a special case in that it does not reference a previous block...

Now to your questions:

Like, if I fire up a few nodes and transfer some testETH between them, is that exchange the "genesis block"?

No, as soon as you 'transfer', it's not a part of the genesis block anymore.

Is it simply the first transaction I manually engage in?

Technically, it (genesis block) is the block referred to by the first transaction(s) you make (which will, of course, happen in the first block).

I assume it has to get mined like any other, yes?

No, it is not mined. It is essentially the 'system', or more precisely, the EVM state as soon as a node with a new chain (or a copy of a new chain) starts with. The mining will happen from then on, and most likely, other transactions will refer back to it (as in your case of sending testEth.)

I have to ask this because the block does not seem to automatically happen if there are no transactions.

This is interesting. Did you try checking from the console the current block height? I suspect there might be an issue with your explorer. Otherwise, it seems very much a specific configuration of your test node. Because, there doesn't have to be a transaction for a new block to be mined. The miner(s) will keep mining to meet the new block mine interval time criteria. I run a test node with Geth, and the blocks are mined irrespective of the transactions being there or not; this is basically what a miner is supposed to do and is the ideal behavior of a miner.

UPDATES: More details/ rationale on why the genesis block is not mined.: The essential definition of mining in the context of the Ethereum network is two fold:

  1. Processing and validating the transactions (also including the smart contracts)

  2. Mining the block for consensus using proof-of-work/ ethash.

Now the genesis.json file, as I previously answered, sets the state of the node. There are no actual transactions, and hence no mining. There is nothing actually being transferred in the description of genesis.json, it is a mere description of wallets.

The question of the gasLimit limit field is just an initial point of reference to start with. It might (and it does) change as per the behavior of the network participants in the Ethereum mainnet. In case of private chains, you would tweak it as per your needs. But it has nothing to do with the 'mining of the genesis block'. Even if you set it very low, say something that would allow only five transactions, and put hundred addresses and their corresponding balances in genesis.json, the genesis block would flow as smoothly as any gas (sorry for the bad pun).

I rely on the yellow paper for my source of definitions.

Related Topic