visit
If you can’t explain it simply, you don’t understand it well enough. — Albert Einstein
Einstein explaining blockchain technology, 1422 B.C.
In short, a blockchain is just a way to structure data. That’s all there is to it. It is a ledger: A file that keeps track of accounting records.
This file is comparable to a book that is never finished. Each page in a book has information written on it and a page number on the bottom. Because of this page number, you immediately know where the page belongs in the book. Page 49 is obviously found between page 48 and 50. Just like pages, blocks are filled with information. Although blocks don’t have exact numberings, they have a timestamp, which fulfills the exact same function. A new block is always added after the block with the most recent timestamp. As such, a chain forms. The cool thing about blockchains is that they use to make sure that we notice it when any information on any page in the book is changed. This property makes it a good data structure to keep track of records of anything of value.Use cases for blockchains.
In Bitcoin’s blockchain, the blocks contain information about transactions in Bitcoin. The block states who sents which Bitcoins to whom.
As the blockchain has been used to keep track of the movement of all Bitcoins since their inception, the ledger can be checked to know exactly who owns which Bitcoin at any time. The ‘who owns what’ at any time, is what we call the current ‘state’ of the blockchain.
A transaction only occurs once it is included in a block and added to the chain. Hence, when a block is added to the chain, the state of the blockchain is updated. After all, Bitcoins have moved. This means that if I want to validate whether someone actually made a transaction to me or not, I have to be able to check the state of the blockchain. To be able to do this, the ledger has to be publicly available. This is where networks come in.A server-based model vs. a peer-to-peer network This is all very important, but the above doesn’t mean that the blockchain is now suddenly secure enough to be of any actual use to store or transact value. For example, how do I know that the (transaction) data in the blockchain is correct? How do I know there are no invalid transactions in the blocks? And if there are different versions of the blockchain out there, how do I know which shows the true state of the blockchain? These concerns are all taken care, in a quite ingenious fashion, by the consensus mechanism, the use of which is made possible in the first place by the peer-to-peer network.
The ingenious part of Satoshi Nakamoto’s, the mysterious, anonymous founder of Bitcoin, white paper was combining the two with a consensus mechanism based on cryptography. The consensus mechanisms is where the real magic happens: it allows nodes in a peer-to-peer network to work together without having to know or trust each other.
“The purpose of a consensus algorithm is to allow for the secure updating of a state according to some specific state transition rules, where the right to perform the state transitions is distributed among (…) users which are given the right to collectively perform transitions through an algorithm” — Vitalik ButerinNow, if you didn’t quite catch that, the consensus mechanism is simply a set of rules, which is agreed upon by the nodes in the network by running the software of the network. These rules make sure the network works as intended and stays in sync. The consensus protocol sets rules on:
A bitcoin mining rig. To have enough processing power to mine, you need a lot of GPU’s. Bitcoin’s Proof of Work is not the only consensus mechanism. Proof of Stake (PoS) is also commonly used in distributed ledgers. In a Proof of Stake based mechanism, one can ‘stake’ his coins for a chance to be picked to add the next block. In a sense, a staker says: “ I bet my coins that I add this block correctly”. If he lies, he loses his coins. There is a on which consensus mechanisms is best. Still, regardless of how the block is created, other nodes in the network still have to be able to decide on whether the block is valid or not.
In other words, the nodes’ software check for all the transactions in a block if the senders have received enough Bitcoin to make their transactions. To do this, they check the state of the network.
Now, let’s say I have received 1 Bitcoin, which I later send to Alice. I then try to send the same Bitcoin to Bob. As soon as the block with my first transaction in it is added to the chain, all nodes will update the blockchain to reflect that I don’t have that Bitcoin anymore. Any newly mined block that would contain my transaction to Bob would simply be rejected by the nodes. The nodes’ software sees that the block does not follow the rules, thus, they don’t update the blockchain for this block.The rules also dictate that a transaction is only valid when it is signed with a digital signature from the owner of the bitcoin. Only the person who controls the wallet or address from which the bitcoin is send can sign of on the transaction. Therefore, only you can spend your Bitcoin.
Visualisation of blockchain fork. When we have an unintentional fork, some miners will start mining on one chain, and others will start mining on another chain. Inevitably, one chain will have more miners than the other, and as such, will add new blocks to its chain faster. The rest of the miners will then switch over to the longer chain and the forked chain will always die out. No damage is done to the main chain. Why do we know this will always happen?
Because miners are economic actors that act in self interest. A miner has no interest in mining on a forked chain, knowing it will die out. All transactions (state transactions) on the forked chain have never occurred on the main chain, which means that miners who mined blocks on the forked chain are not rewarded for their work. The miners’ opportunity cost of mining blocks that will not be included in the main chain is simply too high.
In rare occasions, it can occur that a forked chain has a substantial amount of mining power. In this case, it can take a while before it is clear which chain is the main chain. Conventional wisdom dictates that it is therefore wise to wait for 6 blocks to really confirm a transaction.Visualisation of an extended blockchain fork. This almost never happens for more than 5 blocks.
The rule that the longest chain wins, combined with the fact that one needs immense processing power to add blocks to the chain makes the blockchain incredibly secure. Pretty much the only way to attack the network is by going back to some block in the blockchain, forking the chain and starting to mine new blocks from there. However, to do so, an attacker would have to re-do all the work done by miners from that point and catch up to the main chain. Without having more computational power than the whole network of miners combined, this is simply impossible. Simply said, the electricity and GPU’s needed for such an operation would be far to costly.
Thijs Maas is a law student with a healthy obsession for the legal challenges that arise in relation to the wave of innovation brought by distributed ledger technologies. He recently founded , a website that acts as a hub for information, insights and academic research on the subject.