L18 – What is a Block (CBDE Course)

In this lecture we are talking about blocks A block in Ethereum, like on the Bitcoin network, has to be mined

Let's directly deep-dive into how that works: Currently, at the time of recording this lecture, mining still works with proof of work That means – somewhere on this world- ethereum nodes are competing to find the solution to a mathematical riddle If this riddle is found by one node then this node can add another block to the blockchain Here is exactly what will happen when a node found a block: First, the node will get a reward for finding that block That is currently 3 Ether

The node is adding 3 ether to it's own coinbase or etherbase address Then the miner will look at the list of pending transactions It will sort these transactions by the gas price from high to low and include as much transactions as it can in the block The gas for these transactions is also added to the balance of the miner Then it will also include uncles or ommers and reward them

They are called orphans on the Bitcoin blockchain and dismissed In Ethereum they are rewarded as well, but that's another story And then the whole block is sealed and pushed to the network And then all of the transactions are also re-done basically on all other nodes of the network This makes sure that the miner node wasn't cheating and everything is working exactly as planned

That is called consensus Everybody agrees on the result But there are also more things happening under the hood The block has several properties if you are looking at a typical block explorer There is the difficulty for example

The difficulty determines how difficult is it to solve that mathematical riddle And the difficulty is variable A block in Ethereum should be mined every 10-19 seconds If it takes less than 10 seconds, the difficulty increases If it takes more than 19 seconds the difficulty decreases

The next blocks will be either easier or harder to mine The exact algorithm is implemented in each and every Ethereum node And by having consensus across the network, meaning that every node will redo all calculations that the mining node did and therefore validate a block, it is clear that every node will itself increase or decrease difficulty Well, or leave the difficulty as it is So here is your take away: When you send off transactions then a mining node will include this transaction in a block

Blocks should be created every 10-19 seconds If it takes longer difficulty decreases If it takes less than 10 seconds to mine a new block, then difficulty increases And every calculation is re-done across the network, which is the way consensus is reached

Comments are closed.