Karachi   ->   Sweden   ->   Karachi, again   ->   Dubai   ->   Bahrain   ->   Karachi, once more   ->   London and Leeds

Wednesday, August 01, 2018

Blockchain 101 for Developers - Part 1

What problem does Blockchain address?
(In very simple terms) Blockchain primarily addresses aspects of record keeping across multiple, distributed peers such that trust between them is no longer an issue and no central authority is needed either.

In today’s world, each organization/ peer participating in a business network performs its own bookkeeping of facts of interest. For example, a car manufacturer would have its own data related to the cars manufactured and a car distributor/ reseller will have its own data---even through there are overlaps and they might be talking about the same asset (i.e., a specific car). Same goes for financial institutions---each bank will have its own data. Such silos definitely need either central authorities/ middle-man who everyone can trust as well as settlements and reconciliation processes to iron out conflicts.

Blockchain addresses all these problems by acting as a distributed ledger, which everyone can trust and have access to.

Bitcoin uses blockchain to record facts related to “coins” and their “transfers”; the interaction is from peer to peer and there is no central authority. But the technology itself is much more than what I have just stated.

How does blockchain do that?
Blockchain is, no pun intended, blocks chained together. Each block contains certain facts, and the entire chain is (usually) replicated across all peers and it is immutable.

For people with data structures (computer science) background, the chain can be thought of as a doubly linked list with an additional property of immutability.

Immutability? What? Why?
Immutability means that you cannot practically change a block, once it is added to the chain. This is achieved by using hash functions (one-way functions from cryptography). Each block contains a hash value generated from the facts in that block as well as the hash of the previous block. Therefore, modifications to a block is not possible unless all blocks from that point onwards are rewritten, which is not feasible as other peers also contain a copy of the entire blockchain.

Since blockchain is immutable, nobody needs to worry about fraud/ trust issues as long as no participant has more than 50% of the computational power in the network; more on that later.

In addition to immutability, blockchain also implicitly means decentralisation by employing a consensus protocol.

Consensus? On what and how?
Consensus on which block gets added next to the chain. In bitcoin, this is achieved by using some aspects of game theory and is termed as proof of work. All peers compete to add the next block to the chain and they have to solve a (useless) mathematical puzzle with each block they want to add to the chain. Solving this puzzle is a computationally intensive work and introduces a sort of randomness to who among all the peers gets to add the next block. Whoever creates a valid block broadcasts it to everyone else. In bitcoin, the peer who successfully creates a new block is said to be a miner and they are rewarded with some fresh bitcoins (said to be mined in the process).