Blockchain Demystified

M Zain
HashThree
Published in
5 min readMar 8, 2022

A blockchain is essentially a storage mechanism vis-à-vis a database. But owing to the way it is implemented, it’s ultra heavy on reads & writes and super lean on updates & deletions.

Reading a piece of data from a blockchain is super easy. Writing onto it is a tad-bit tricky but easy nevertheless. But updating or deleting existing data is annoyingly cumbersome.

Implementation

A block-chain is essentially a series of data-blocks chained together via a cryptographic function.

Imagine that you’re a shopkeeper and you’re keeping track of your daily income. At the end of every working day, you record your sales for that day onto this blockchain.

Let’s see how you’d do this —

Block

A bare bones structure of your day’s record would be as follows —

Let’s call this a block of data.

Quick word about hashing

hash An unique identifier assigned to this block. But most importantly, it’s an identifier derived from the combination of

data being stored on this block; and

hash of the last block on this chain of blocks (blockchain).

hash is computed by means of a specific cryptographic technique called hashing.

The idea behind hashing is to convert data of any size and type onto a fixed-length output. Furthermore, this output should be same for same input and drastically different for different inputs.

An example hashing function would be as follows —

hash("Welcome to KYC") = 3f30d966cd32c8855626ca928676f9b88cc6e4ab8e7c1b01a448b65558e3ba9c

Blockchain

With that understanding of the block, blockchain essentially is a series of blocks chained together by hashing.

This chaining is embedded in the fact that every block derives its hash based on the previous block’s hash.

A block-chain would look as follows —

As intended, we’re able to record your each day’s sales in the chronological order.

  • First block represents the sale on 27th Feb, the second on 28th Feb, the third on 1st March and the fourth on 2nd March.

We can continue adding more such blocks as more and more days elapse.

But here is the major catch with the blockchain. If you tamper with second block (BLOCK II), each subsequent block will get changed. That is the hash of BLOCK III and BLOCK IV will change drastically. Not just that but its own hash (that is of BLOCK II) gets changed as well.

Let’s try and do this once.

By merely changing a single field (i.e. sales under data) on BLOCK II, we saw that every single block’s hash (including its own) thereafter got changed.

This isn’t a big deal on its own. But when you factor this into a system that drives cryptocurrencies, it becomes massively powerful.

Distributed Blockchain

Cryptocurrencies use a modified version of blockchain. This one is called a distributed blockchain and it isn’t very different from the one we saw so far.

A distributed blockchain is fully and wholly same as the one listed above. But there is a slight change in the way it’s maintained.

In the above example, only you keep a copy of this blockchain. Nobody else has access to it and nobody is worried about its state but you.

But in the case of a distributed blockchain, everyone, who so wishes, has a copy of this blockchain. And most importantly, everyone at all times should continue to have the exact same replica as everyone else.

Anytime there is a difference in anyone’s copy, it either has to be

  • accepted by everyone else and thus, this becomes the updated copy that everyone now keeps; or
  • discarded by everyone and thus, the one who came up with this different copy must get rid of it and continue to use the previous one.

In practical implementations, rather than everyone agreeing, it’s enough that a majority portion of the involved participants agree or disagree with the different copy.

A different copy can be created by three principle ways — addition, updation or deletion.

  • Addition essentially means one of the participant adds a new block to this shared blockchain.
  • Updation amounts to a participant picking any one block that’s already present on this blockchain and making amends to it.
  • Deletion, as obviously, is when an existing block from within this blockchain is deleted altogether.

Of all the three approaches, addition is easiest to make and more often than not, it’s easily accepted by everyone else as long as there is a way to know that a valid addition has been made.

1 A. A block is being added by one of the participants.
1 B. If agreed upon, everyone else updates their own copies.

But updation or deletion are the hardest to realize. Updation or deletion of a specific block corrupts the blockchain from that block onwards (as we saw above). This corruption is easy to detect when everyone has a copy of the original blockchain. The hashes of all the blocks would be different from that block and further. An event like this is rarely accepted by others on the system.

2 A. A block is updated by a participant.
2 B. If agreed upon, everyone else updates their own copies.
2 C. If rejected, everyone goes back to their original copies.

This very resistance to tampering the past is what makes distributed blockchains a cornerstone innovation in realizing trustless systems such as cryptocurrencies.

A trustless system means that the participants involved do not need to know or trust each other or a third party for the system to function.

Trustless systems need that their histories be not tampered with. But even in the case when histories do get tampered, they need a quick way to detect it.

A distributed blockchain lives up to these requirements in a very effective way.

Closing thoughts

That’s it. Blockchain is not different in its intentions as every other database system. It merely tries to keep track of data that is being thrown at it. But it becomes game-changing when it acquires a distributed nature. Its cryptography backed resistance to tampering when in distributed form makes it an ideal candidate to run trustless systems. These system seek strength against re-writing of history and if attempted, a fast way of detecting the re-writes. Blockchains offer both of these capabilities in perfect harmony.

--

--