Blockchain 101 Chapter II: Blockchain in a nutshell
By Mikko Mielonen on The Capital
Synthesis
What we now call blockchain was first described by a group of researchers in 1991. They were presenting an idea for signing a digital document so that the documents could not be tampered with. This technology didn’t become very popular before the invention of the currently most famous blockchain, Bitcoin. Although it is the most famous blockchain creation so far, the blockchain technology applications are not limited to digital currency. You can build any data storage on top of the blockchain.
Forming the blockchain is quite easy in principle. In reality, it can be anything, but. To put it short, let’s make a simplified example. First, you need to gather data that is ready to be archived as a “block.”
These blocks of data are then linked together in chronological order to form a “blockchain.” This will ensure that the blockchain always has the relevant and latest data available. The longer the chain, the more tamperproof it becomes after each additional block.
The links between the blocks are just a sequence of numbers and letters called hash value (also known as “hash” or “checksum”). This hash value is calculated using a hash algorithm, which is just a series of rules that are applied to some data, and which will ultimately result in a hash value.
For example, a hash algorithm could be “count the number of characters and take the last digit of that number.” If we apply this algorithm to the character sequence “This is data to be hashed,” the hash value would be 5 because there are 25 characters and the last digit of 25 is 5.
Note that the calculation of the hash value is completely deterministic, which means that there is nothing random about it. The same data will always result in the same hash value.
Creating chains
So how do these hash values link the blocks together?
The answer is simple: when we want to add a new block to the chain, we calculate the hash value of the previous block and put that value inside the new block, so that it becomes a part of the new block’s data. The new block then basically contains a “digest” of all the data in the previous block, in addition to the data it would normally contain.
This feature is what makes the blockchain resistant to tampering. Let’s say a dishonest actor Cyberman2000 wants to add a transaction that never took place in a previous block. Before tampering, the hash value of the block is, say, “9rYji2”. Cyberman2000 adds a transaction that never actually took place in that block, and so the hash value of that block changes to “Ti5eNr”. The next block in the chain states that the hash value of the previous block is “9rYji2”, which does not match the hash value of the tampered block “Ti5eNr”. Thus, the following blocks in the chain would no longer recognize Cyberman2000’s tampered block as part of the chain.
Now there are 2 options for this kind of tampering to work:
- The need to change every single block in the chain after the tampered block, or by some miracle, change the content of the tampered block again and by some miracle hit the same hash value “9rYji2”. In practice, option number one cannot be done as the blockchain is distributed around the world.
- The need to hack the majority of the computers containing the entire blockchain simultaneously. That is not going to happen. Option number two is also practically impossible because blockchain hash algorithms are specially selected so they cannot be “reversed.” The chances to come up with a block that is both beneficial to Cyberman2000’s cause and also has the valid hash value are astronomically low.
This is the blockchain in a nutshell. The first block of the chain is called the genesis block, and it is a little different since it does not have a previous hash in it being the first.
The creator of the blockchain will decide what it contains, but for example, the very first block of Bitcoin contains a secret message “The Times 03/Jan/2009 Chancellor on brink of second bailout for banks” imbued in the raw data of the block.
The idea of the block is to generate a hash for the next block where the actual blockchain begins. In the case of Bitcoin, having this newspaper headline inserted in it proves that Bitcoin genesis block was created on or after the 3rd of January 2009, but not earlier.
Unless the creator was the chief editor of The Times and Alistair Darling at the same time.
What do we do now?
The blockchains of today are divided into three different archetypes. The division is done on how distributed and accessible the blockchains are.
- Public blockchains are the blockchains that are accessible by everyone. The only requirement is just an internet connection. For the people to start to mine and participate using the blockchain, it has to offer some economic incentive and value.
- Private blockchains are the blockchains where you need an invite by the network to join. These kinds of blockchains are, for example, corporate ones where requirements of the level of data security or control of the blockchain are not met with a publicly accessed version. This is not a truly distributed ledger as one entity is controlling it completely.
- Consortium blockchains are the ones that combine the previous two. The blockchains are semi-decentralized, meaning that more than one entity is controlling it. The blockchain administrators can decide how much each participant can access the data stored in the blockchain or who can form new blocks into it.
But what does it mean when people say it is a distributed ledger? The way the blockchain is different from a traditional ledger is the idea of spreading the ledger to anyone or a specific group of people. By spreading it to more people, you can generate trust in the blockchain without trusting one entity. If the ledger is held by thousands or millions of people, then it will be almost impossible to tamper with it since you would have to tamper them all or most of them. This means that you don’t have to trust one entity to run it, but you have to trust that the network has enough people participating that tampering it would be nearly impossible.
This method of data storing provides security without needing to trust any entity. Granted you have to check up or trust that the blockchain is coded in a way it is described to work.
The blockchains of today have many methods of adding new blocks in them. The most popular ones are POW (Proof Of Work) and (d)POS (Proof Of Stake or delegated Proof Of Stake). It is up to the creator of the blockchain to set a method for block creation. There is no one right way to do it. There are too many different types to go through them all, so let’s go over Bitcoin.
Bitcoin the chain
The most important thing to remember is that the way of Bitcoin is just one way of maintaining a blockchain.
Maintaining the network is incentivized by giving a reward for participating in the network. To receive it, you will have to show POW (Proof of Work). That means you will have to solve a very difficult puzzle and to find a solution, you have to use a lot of computing power. POW in Bitcoin means a piece of data that is hard to produce but easy to verify. As a side note, Bitcoin uses the hashcash proof-of-work function.
The Bitcoin network will give a new block to solve one by one after the previous one is solved. The block contains a cryptographic puzzle that is unique to every block. The computers that are “mining” will solve the puzzle, and the one who finds the correct answer first will get a reward to their Bitcoin address, and the block is closed with previous transactions inside.
“Mining” is a process of adding transaction records to Bitcoins public ledger of past transactions. But only the one who solves the puzzle first can do that.
In Bitcoin, the blocks are of a certain size (1 megabyte), and the solver of the puzzle can select which pending transactions to put inside the block. It is more likely that there are more transactions than there is space in the block. This is why there is a transaction fee in Bitcoin. If you give a small incentive to the miners, they will most likely put your transaction to the block because they will get your delegated fee for themselves. The actual Bitcoin block size is bigger now (maximum of around 4 megabytes) because of an update, and it is more than likely that there will be more updates coming in the future. This is a highly disputed topic inside the Bitcoin community because it is not the only way of increasing capacity.
Bitcoin blocks were originally coded to have 50 Bitcoin reward for solving the puzzle and to halve the reward every 210,000 blocks generated. This will take the network roughly 4 years to do since solving one block is aimed to take 10 minutes. At the moment, the reward is 12.5 Bitcoins for a block and after a total of 34 halvenings (it means the reward is cut in half), there are no more Bitcoins created ever. This is going to happen roughly May 7th, 2140, and there will be slightly under 21 million Bitcoins. Generating new Bitcoin for the miners will incentivize more and more people to join to maintain the network, which in turn will make it more secure. The vision in Bitcoin is that the transaction fees will be enough to keep people mining the Bitcoin even when there is no initial reward put in by the network.
Anyone can join the network to start solving the puzzles. Bitcoin is coded to check the number of puzzles solved every 2016 blocks and then make the puzzles harder or easier to maintain the 10-minute block generation.
https://bitcoinwisdom.com/bitcoin/difficulty — taken 3.1.2019
In the picture above, you can see how the hash rate of the network is going down first and then going back up. The red line of actual difficulty is following the green line of actual hashrate every 2016 block. This will keep on happening for as long as anyone uses Bitcoin.
The Bitcoin blockchain always recognizes the longest chain to be the correct one. The longest, in this case, means the most combined difficulty on solved blocks. This will make it very hard for people to overtake the Bitcoin network since you would have to have 51 % of all the mining power in Bitcoin to take over it. The amount this equipment will cost the entity trying it will be enormous, and you will achieve very little with it since the popularity of Bitcoin is hugely based on the principle of trusting no single entity.
The End
So to summarize the Bitcoin blockchain is working like this:
- A new block is formed
- Miners find the solution to the puzzle
- The solution is verified by the network
- The miner who found the solution selects the transactions to put inside the block
- The new block is put in the blockchain and cycle continues