Blockchain: The Concept behind Bitcoin

Afaan Bilal
6 min readFeb 10, 2018

--

The Blockchain

Currencies or, in general, money are an integral part of our lives since times immemorial. All worldly transactions involve money and almost every form of money is controlled and regulated by some central authority. These central authorities commonly known as Reserve Banks or Federal Reserves are responsible for and have the authority to print and control said currency. These authorities are in turn under the control of the governments of that nation. If, for some reason, the government decides to remove their “guarantee” of value from some of the currency, as we witnessed not quite so long ago during “demonetization” and all that followed, the value of the currency becomes null. That is to say, the value of the printed currency is only as good as the “guarantee” of the controlling authority behind it.

Ever since the advent of the internet, people had been trying to come up with ways to do transactions that did not involve these controlled and regulated currencies, whether for nefarious reasons or lack of trust or just privacy concerns. Many had even created digital currencies that existed solely in the digital world and could be used to perform transactions online. But, since these currencies involve digital tokens of some kind, and due to the inherent nature of digital data making it easy to copy or fake these tokens, all these currencies were plagued with the same problem — double spending.

Double-spending is a potential flaw in a digital cash scheme in which the same single digital token can be spent more than once. This is possible because a digital token consists of a digital file that can be duplicated or falsified.

Wikipedia:Double Spending

Now, to counter this problem, there needed to exist a ledger or a book of records from which it could be verified if a token had already been spent. But who would keep and maintain this book of transactions? If we were to designate someone as “trusted” by everyone and allow that entity to keep and maintain this book, we would again arrive square one: centrally controlled currency as there was just one entity controlling the book of records and hence everything. This also meant that if something happened to this central entity, like data corruption or unauthorized access, everything would be lost — what is commonly called as the single point of failure.

Thus, this reason and a quite a few others ensured that these digital currencies did not gain much traction. That is until the one currency — Bitcoin — the first decentralized cryptocurrency came into being.

The question that comes to mind is this: how did Bitcoin solve this problem?

The answer: Blockchain

Blockchain

Blockchain

A blockchain is a continuously growing list of records, called blocks, which are linked and secured using cryptography. Each block typically contains a cryptographic hash of the previous block, a timestamp and transaction data.

Wikipedia:Blockchain

The blockchain, Bitcoin’s answer to the problems of the digital currencies, is also a ledger of records. But, the main difference is that this ledge is decentralized, that is, controlled by no one and everyone at the same time. Every single participant in the Bitcoin network has a complete copy of the ledger and thus there is no single point of failure.

But, how does this blockchain work? And since it is controlled by everyone, what prevents a malicious attacker from inserting counterfeit transactions into the blockchain and becoming very rich?

To understand this, let us first understand how a blockchain is made.

Let’s say a few people do some transactions using Bitcoin. These transactions are compiled by people (called as miners) into a list called a block. Then, some additional information is added to the block like the timestamp and most importantly a cryptographic hash (we’ll get to this soon) of the previous block. All this data is the run through a special process called as “hashing” which generates a sequence of characters called as the cryptographic hash of the block. This hash is unique for every different input. If you were to change the input data by just one character, the output hash would be completely different.

Now, the Bitcoin network places some special restrictions on the hash of a cryptographic block for it to be inserted into the blockchain. For the sake of an example, let’s say it’s something like: every hash should have 11 zeroes at the end.

What we must know about cryptographic hashing is that the process is such that we cannot predict the output of the process based upon the input, thus, the only way to know what the hash of some data is to run it through the process and then look at the result. So, the miners add some data to the block and then run it through the process and check if the resultant hash has 11 zeroes at the end, and if not, then rinse and repeat. This is essentially a trial and error process. If, the hash does match the criteria, then the new block is accepted by the network and added to the blockchain. This hashing process is computationally very intensive and uses a LOT of resources like computing power and electricity.

This is called as proof of work.

A proof of work is a piece of data which is difficult (costly, time-consuming) to produce but easy for others to verify and which satisfies certain requirements.

Bitcoin Wiki

So, why do these miners do it? The answer is that if their block is accepted by the network, they get a few Bitcoins as reward for “finding” the block. And when this block is added to the blockchain, since it contains the hash of the previous block, it is said to be linked to that block and thus forms a “chain” of block which we call a— you guessed it — blockchain.

So, how does all this hashing and computation protect the blockchain from tampering by unauthorized people?

Let’s assume we have blockchain consisting of four blocks: A — B — C — D

Now, if an attacker somehow created a block X which satisfied the blockchain hash criteria and he were to insert the block between block B and block C, since every block’s data includes the hash of the block before it, he’ll need to completely re-generate the whole chain after B to satisfy the linkage as the block C does not contain the hash of Y but that of B and thus the link is broken and the attacker’s chain stops at A — B — X. Thus, as Wikipedia puts it:

Once recorded, the data in any given block cannot be altered retroactively without the alteration of all subsequent blocks, which requires collusion of the network majority.

That is, unless the attacker controls more than half of the complete blockchain network, he cannot modify any data that has already been recorded. So, all a legitimate participant has to do is to check which chain is the longest and use that as the correct chain as all other counterfeit chains will be shorter. This makes the Bitcoin network self-reconciling or self-correcting and thus a highly fault-tolerant system.

Thank you for reading.

Disclaimer: Although every care has been taken to make the presented information accurate, no guarantees can be given.

--

--

Afaan Bilal
Afaan Bilal

Written by Afaan Bilal

Senior Software Development Engineer @ Centiment. Co-Founder @ Shmooze. CEO @ Alpha Magnus Studios. Civil Engineer from NIT, Srinagar.

No responses yet