Bitcoin combines the ideas behind time stamping and Hashcash-style proof of work to reach a secure system. This is the main innovation introduced by Bitcoin.

 

The blockchain is an open ledger built as chain of blocks that continues to grow.

Each block contains a group of new transactions and a link to the previous block in the chain.

 

New transactions in the network are collected in a block that is added to the blockchain. Note that the old transactions are still in the blockchain: the old blocks are never removed from the blockchain, so the blockchain can only increase in length over time.

 

Each block is secured with a hash system. This is shown in the diagram below.

First, each block consists of a group of (valid) transactions, the hash of the previous block and a nuncio. The nuncio in a block solves the problem of partial hash inversion. That is, the nuncio is a number such that the hashing of the entire block (including the nuncio) begins with a certain number of zero bits. In the Diagram below, the hash of block 514212, extracted on March 19, 2018, is 000000000000000000002c0cd71a42c9bee…, starting with 72 zero bits (or 18 zero characters in the hexadecimal representation).

 

It is easy to adjust the difficulty to solve a block by increasing the number of bits starting with zero.

The Bitcoin protocol adjusts this difficulty to target 10 minutes between blocks. This difficulty adjustment is part of the Bitcoin rules and is coded in each Bitcoin client.

The block difficulty is adjusted every 2,016 blocks or approximately every 2 weeks. The adjustment takes into account the change in the computing power of the entire network since the last adjustment, by comparing the timestamps of two blocks of 2,016 positions. When computing power is added to the network, the blocks will be extracted faster than the 10-minute target period, which is why the difficulty must be adjusted.

Persons or institutions that bring their computing power to solve the hash partial inversion power are called minors. The use of miners is essential to secure the blockchain, and the protocol rewards them with newly “hit” bitcoins. A block reward is the compensation that is paid each time a miner solves the hash reversal problem. Thus, the new bitcoins emitted are allocated to miners who provide their computing power to secure the blockchain (this subject is discussed in more detail in the chapter “Mining”).

Each block includes a special transaction called Coinbase. The coinbase is the first transaction in a block (see Figure above). It has only one transaction input (TxIn), which is not linked to any previous transaction output (TxOut). On the other hand, the coinbase can have many outputs.

 

The miner who solves the hash problem uses the coinbase to pay himself the reward of the block. This is why solving the partial hash inversion problem is called extraction. All the miners on the network compete to exploit blocks.

A miner’s hash rate is his computing power, measured in hash per second. The network hash rate is the total hash rate of all miners on the network, and it is around 30 000 000 TH/s in May 2018. The extraction of a block can be compared to a lottery, where the chances of a single miner are proportional to his share of the hash rate of the network.

 

As expected, the number of bitcoins allocated is decreasing exponentially, so that the total number of bitcoins in circulation will stabilise at around 21 million.

This currency generation algorithm is considered immutable by the community.

 

As of  May 24th 2018, the total amount of bitcoin in circulation was approximately 17 million. According to a study conducted by Chainalysis, a New York company specialized in conducting analyses related to blockchain technology, between 2.77 million and 3.79 million bitcoin would be lost today because their owner no longer has the private key to access their bitcoin.

 

This is mainly due to the fact that Bitcoin was not very popular when it was first introduced. The first people interested in technology and money embarked on the adventure perhaps  without believing in it too much… They therefore mined bitcoin to recover it when its price was very low. Then these people had to forget that they had Bitcoin and then arrived 2013-2014 with the first big climb of Bitcoin (about $1,000), most of those who had mined Bitcoin in the beginning realized that they could no longer find their key to access their Bitcoin because they had not kept it.

 

Historically, about 99% of miners’ remuneration comes from the block reward, and only 1% from their transaction fee remuneration.

It is expected that over time, a higher percentage of the compensation will be due to transaction fees. The process of block resolution is called mining by analogy with the extraction of precious metals (this subject is discussed in more detail in the chapter “Mining”).

 

The block preceding a given block is called the parent block.

Blocks refer to their parent block in the blockchain by including its hash in their data structure, as in the Blockchain Schema at the beginning. Thus, the blockchain keeps the blocks in chronological order.

The first block in the blockchain is called the genesis block and it was created by Satoshi on January 3, 2009. The order of a block in the blockchain, from the genesis block is called the Blockchain Height.

The last block added to the blockchain is called the Blockchain Head.

New blocks are added above the blockchain head.

 

A fork occurs when two miners arrive at a new block at about the same time. Both blocks solve the partial hash inversion problem, but only one of them can be part of the blockchain in the long term.

The rejected block is called the orphan block. The decision of which branch of the blockchain is valid is not made by any party. Rather, the dispute is resolved organically.

 

A fork can persist for several blocks, as shown in the diagram above. This happens when there is a split in the network, and some miners believe that one fork of the blockchain is correct, while others follow the other branch. The protocol determines that the correct blockchain is the longest in terms of number of blocks. It is therefore in the interest of minors to stop working in a branch as soon as it is clear that it will be orphaned, because work on an orphan branch is wasted. Therefore, forks resolve quickly, usually in only 1 block. The average number of fork was about 2%, i.e. on average every 50 blocks, there is a fork in the blockchain. Forks of more than one block are very rare.

Transactions included in fork blocks are not lost.

When a branch of the blockchain is rejected, the transactions in that branch are re-entered into the memory pool of non-fracked transactions, ready to be included in the next block. Some of these transactions may already appear in a block of the legitimate industry. In this case, these transactions are ignored and excluded from the transaction memory pool.

Each fork resolution produces winners (miners who solved the blocks in the accepted branch) and losers (miners whose solved blocks became orphans). The protocol avoids having a central party or group deciding the correct branch to follow in accordance with Bitcoin’s decentralization philosophy.

The Bitcoin protocol solves a fork in favor of the longest blockchain.

The length of the blockchain is measured by the combined difficulty of all blocks in the chain. If the blockchain difference were measured by the number of blocks in place, an attacker could generate many “valid” blocks with less difficulty than the legitimate blockchain. This is not possible, and an attacker must use a significant percentage of the available network hash rate to trigger such an attack.

 

The 51% attack

 

Virtual currencies are subject to double spending attempts that occur when two different transactions attempt to spend the same funds. The Bitcoin protocol defends against this attack by deciding that the valid transaction is the one that makes its way into the blockchain first. Thus, Bitcoin solves the problem of double spending in a decentralized manner, without needing a central authority to decide which transaction is valid.

 

A transaction is also secured as more blocks accumulate on the block that contains the transaction. An attacker wishing to change the block to a certain block will have to recalculate all the hashes of that block up to the head of the block because each block is dependent on the previous one. In addition, as the Bitcoin network continues to add blocks to the blockchain, the attacker will not only have to redo all the past work, but will also have to keep pace with the creation of new legitimate blocks and surpass it.

The only way for an attacker to achieve such a feat is to have a hash rate as high as the hash rate of the rest of the network. So this attack is called a 51% attack. A “51%” attack is always possible for an attacker who controls less than half the hash rate of the network.

But in this case, the probability of success depends on the percentage of the network hash controlled by the attacker and the number of blocks he needs.

The probability of success is extremely low and nobody has so far succeeded in doing so. It is only when the attacker controls more than 50% of the hash rate of the network that the probability of success is 100%.