Skip to content

Concepts

Proof of Work

Originally, Ethereum was launched with proof-of-work as validation mechanism for the transactions (also called consensus mechanism). In short, proof-of-work relies on cryptographic problems which as computationally heavy to solve, but trivial to validate. Miners, i.e. the entities validating the transactions, must have a big computation power to validate the transactions and the blocks, and add them to the head of the chain.

To state is simply, the miners must find a number (also known as a nonce), which concatenated with the data of a block, result in a hash starting with a certain number of zeros. The number of zeros is referred to as the complexity.

hash(nonce + block n) = 0x00000...complexity...00xxxxxxxxxx

Example (in shell): Find the nonce which, concatenated with "abcd" (i.e. the payload of block n), gives a hash starting with 3 zeros:

for i in $(seq -f "%05g" 100000);
do
  echo "$i + abcd" | shasum -a 256 | grep "^000" && echo "nonce = $i"; 
done

nonce = 01704
hash = 0008587c23951637e74973cd1b33d04d84f208774a11071ebc5a8ecf4eb1d154

Validation

echo "01704 + abcd" | shasum -a 256

proof-of-work-ethereum.png

The first miner finding the solution to the cryptographic problem is getting a reward (the transaction fee) to pay back the electricity, and the hardware needed for this work. The other miners can easily verify the solution. That's the proof of work.

The power of a miner in counted in hash-rate, i.e. how many number a miner can try in a second.

Drawback of proof-of-work

The main drawback of the proof-of-work is that the ratio watt per transaction is really high, and in nowadays civilisation burning too much electricity has a bad reputation.

This is where proof of stake enter the game.

Proof of stake

Proof-of-stake is another technique to validate transactions in the chain. Prior to being allowed to validate transaction, one must have had proven it owns (or owned) a fraction of the chain. This is the staking: the action of freezing 32 ETH to get granted the right to validate transactions.

Staking in ETH is done via a smart contract, to which a future validator must send the 32 ETHs (not more, not less) and the public key that is granted the right to validate transactions.

Once the public key is accepted by the network, the validator start receiving transactions to validate.

The cryptographic challenge to solve here is much less computational intensive than in proof-of-work.

It's basically a signature of the block using the validator's private key and the content of the block. Once signed, every one can check the signature using the validator's public key.

The network is somehow load balancing the transactions (validators are chosen at random or algorithmically depending on the literature, so it's probably a mix of a modulo on the shard and the validator key).

proof-of-stake-ethereum.png

The stake is mostly used to incentivise correct behavior of the validator, or said differently bad behavior of the validator will be sanctioned by penalties deducted directly from the staked amount, until it reaches 0.

Beacon chain

This change from proof-of-work to proof-of-stake is a major update in Ethereum ecosystem and won't happen overnight. The Ethereum community has instead drawn a 3 years roadmap, which started in June 2020.

This roadmap includes the creation of a new chain, called beacon chain. This new chain is entirely based on proof-of-stake validation (consensus), and will be gradually be validated (on-going) and scalled (shard chain, targeted in late 2021), until it will completely replace the mainnet chain (called docking).