Blockchain Basics & Consensus (summary of MIT lecture 2018 by Gary Gensler, lecture 4)

For this week, you had to read “A short guide to Consensus Protocols” on CoinDesk.

This subject of this lecture is **“What makes a block on the blockchain valid”?**

**China (2018) problem**

The blockchain relies on a good working internet; that internet prorocols are adhered and it’s not walled off and not corrupted. But what would happen if that’s not the case? For example, if you are in China (remember this lecture is from 2018!) and someone manages to capture a large part of the internet there? If they wall-off the internet there, what will happen?

What if a corrupt miner in China mines a new chain and other Chinese miners start to build upon that block?

This is an example of the Byzantine Generals Problem; you have to rely on actors and you don’t know if everyone of those is reliable and honest.

​

**Keep the network honest (x2)**

In his email of 2010, Satoshi Nakamoto proposes two solutions to keep the majority of the network honest:

1) consensus protocol

2) native currency

​

**Consensus protocol**

The consensus protocol is proof-of-work (an idea of HashCash’s Adam Back in 1997 that was aimed against spam email, but was never widespread / implemented). POW requires a bunch of computational work using hash functions. The difficulty of finding whether a block is confirmed, was in a certain range of hashes. The difficulty is determined by leading zeroes. A leading zero is any 0 digit that comes before the first nonzero digit. In 2018, the blockchain requirement of Bitcoin was to find a nonce that crates a block-hash with 17 or 18 leading zeroes.
The actual hash difficulty is not about the leading zeros; it is about finding a hash less than the hash target set by the network. In Bitcoin, the SHA-256 hash algorithm generates a 64 digit hexadecimal hash value.

It should be difficult to solve, but easy to validate. Finding the specific hash is difficult, but validating is just running 1 hash function.

In this system, nonces are needed. Nonce = a number used once.
You need to try many random numbers to get the right number of leading zeroes.

The hash is based on the data. If you change a little piece of data, the hash will look completely different.

Back to the China question. If someone who has captured a large part of the internet in China starts to mine unvalid blocks, and others start to build on top of that, what will happen?
The consensus in Bitcoin is that the longest chain is the only valid chain. If someone in China who doesn’t have the majority of nodes starts mining, it probably won’t be the longest chain, thus rendering the new side chains invalid.
The other miners will probably get word of the fact that they are mining on top of bad blocks which are not supported by the majority of nodes, and will therefore stop putting their equipment and energy into this futile endeavour.

There will be a coinbase transaction (coinbase transaction = the first transaction in a block. If a miner “wins” a block, a minder can create a coinbase transaction with which he or she will collect a mining reward).

The transactions will be useless, because they will not be on the main blockchain.

(My personal opinion: this is not a protection against 51% attacks! This is only a protection when bad actors have less than 51% of the network in hands).

What happens to the blocks outside of the main chain?

1) The bad blocks become stale blocks. They are not being used, but they are still in the mempool (mempool = pool of unconfirmed yet validated transactions)

2) A whole new chain is created, like Bitcoin cash. And that hard fork also has also gotten a new native currency (Bcash).

​

**Native currency**

It takes about 10 minutes to mine a block of Bitcoin. The difficulty of the puzzle is adjusted based on the average solving time of the previous 2060 blocks. If there are less miners and the average time to solve the puzzle is 14 minutes, the puzzle becomes easier. If there are more miners and the average time to solve the puzzle is 6, the puzzle becomes harder.
Because of miners that get better equipment, in 2018 it was 7 trillion times more difficult to mine a block than in 2009. In the past, people mined with CPUs (2009-2010), GPUs or GPU rigs (201002013), and from 2013 to 2018 and beyond with ASICs. The latter ones have to compete against Modern Mining Factories, that are usually in countries where the cost of electricity is very low. The energy use is a problem; in 2018 those mining factories’ use of electricity was comparable to the use of electricity in countries like Ireland or Denmark!

Why would you buy expensive equipment to mine, if your chance of mining a coin is quite low (like 1 in 10 years?). A found solution is to join a mining pool. In this, a mining pool operator, who charges about 1-3% of the returns, facilitates the collaboration of many different actors. Unlike the inidivual miners in the pool, the pool operator has the use of all the miners and probably has 1 whole node or more to her use The mining pool operator can create a Merkle root, so that the computers of the individual actors don’t have to do many extra things. This system of mining pools smooths out economics for all mines that participate in it.
Why won’t all mining pools come together and start a kartel just like OPEC does in oil? This would form a potential 51% attack. It just hasn’t happened yet. “Dr Doom” Nouriel Roubini thinks Bitcoin is centralized because of these mine pools, because you only have 20-30 mining pools. But nodes also do non-compensated work by validating many transactions beyond their own pool. This is the economics of freeriding in which non-pool-miners can profit from.

A native currency is an economic incentive system.
The monetary policies vary wildly, but usually it limits the supply of the currency (some Initial Coin Offerings don’t do this).

BTC is created in the coinbase transaction of every block. The reward for mining a block was initially 50. In 2018 it was 12,5. Every 210.000 blocks, this reward will be halved.
In 2018 the inflation rate was about 4%. Because of the halvings, the inflation rate will become 2% to 1% to 0,5% and it caps around the year 2040. This monetary policy was put in place in 2018 and will be there forever to cap Bitcoin at 21 million BTC.

​

**Networks**

This part didn’t go into great detail.

Characteristics of the Bitcoin network are:

\-Full nodes

\-Pruning nodes (less so for Bitcoin)

\-lightweight nodes (only using the headers, like Bitcoin wallets on your phone)
\-miners that perform POW and create blocks (do not need a full node, but pool operators probably have 1 or many)
\-mining pool operators

\-wallets (to store, view, send and receive transactions and create key pairs)

\-mempool (pool of oncofirmed, yet validated transactions)

​

**Alternatives to POW**

In the CoinDesk reading alternatives to POW were mentioned.

Proof of stake – coins are not mined, but the actor who has the biggest amount of staked coins has a bigger chance to become a validator of transactions (which they get rewards for)
Proof of activity – a combination of POW and POS. In mining, POW and their rewards are used. After the mining, it goes to a system of POS

\-Proof of burn – the bigger amount of coins you burn, the more chance you have to be permitted to mine the next block. Burn = send the coins to an address where they can’t be retrieved.
\-Proof of capacity – the bigger the hard drive, the more chance of mining. Software puts plots on your harddrive. The more plots you can store, the better your chances to find the next block

\-Proof of Elapsed time – made by Intel. There are no elaborate puzzles to solve, so the energy waste is far less. Who gets to mine the next block is like a lottery, however, this goes through a central authorization (TEE Trusted Executed Environment, of Intel) which defeats the purpose of decentralization.

View Source

4 thoughts on “Blockchain Basics & Consensus (summary of MIT lecture 2018 by Gary Gensler, lecture 4)”

Leave a Comment