Let’s take a quick look at what the blockchain is and how it can be explained to a stranger during an elevator ride.
In a nutshell
The blockchain is basically a web based technology that connects multiple users and forms a global or local network in which every single participant possesses the complete information of the network. This characteristic is why a blockchain is pretty much the opposite of a cloud. Remember, in the cloud the information is stored in just one place, which can be accessed by everyone. The data in a blockchain is segmented in smaller units, called blocks.
What is a “block”?
The blockchain consists of a large number of blocks. Blocks are data container structures that aggregate transactions in order to be included in the public ledger and added to the end of the blockchain. They are made up of 2 parts: The header, containing metadata, and a long list of transactions that make up the bulk of the block‘s size. An average block contains over 500 transactions.
The header of the block consists of three sets of block metadata. One part contains the difficulty, timestamp and nonce, taken from the mining competition of this specific block. Another part contains the so-called Merkle tree root. That is a data structure which efficiently summarizes all transactions in the block. While a third part contains a reference to the previous block hash, which connects this block to the previous block in the chain.
How are they chained together?
A block can be described in two different ways: By its position in the blockchain or with its cryptographic hash.
The position of a block is called the block height. Imagine a large tower of boxes where the base has the height 0. Each box added on top of that is one position higher. On December 9, 2019, the block height of the Litecoin blockchain was approximately 1,750,000. This means there were 1,750,000 blocks stacked on top of each other, including the first one created in October 2011.
The block height is not part of the data contained in a block. Each node dynamically identifies a block‘s position when it is received from the bitcoin network. Unlike the hash, the height is not a unique property. Although a single block will always have a specific and unchangeable block height, the block height does not always identify a single block. It is possible that two or more blocks might have the same block height. In that case they are competing for the same position until the conflict is resolved.
How to get rid of conflicts
It is because the blockchain technology has got a decentralized data structure, different copies of it are not always 100% consistent. This happens when two miners are able to generate a possible new block at nearly the same time. Both will start to broadcast their success to the global network.
As soon as the miners/nodes are informed about such a success, they will start searching for the next block using the new block as the starting point. Consequently, there are two different groups of miners/nodes in the network operating with different bases.
These groups are called forks. Forks occur as temporary inconsistencies between different versions of the blockchain, which are resolved when more blocks are added to one of the forks. This is possible because the network is based on a consensus that always uses the longest available chain.
Right at that moment, when one of the groups is able to add the next block, the success is communicated throughout the global network. This causes all participants of the shorter branch of the chain to stop trying to expand their fork and accept the longer chain as their new base. The conflict is resolved.
Why the blockchain is safe
Taking the example of the stacked boxes again, changing the latest box is comparably easy. The manipulation of the box below is where it already gets extremely complicated. Replacing that second box is impossible without affecting the box on top.
The deeper a box is buried in the blockchain the harder it becomes to manipulate it. If you want to change the very first box at the bottom of the tower, the whole tower would have to be rebuilt. That is, without anyone noticing. Impossible.