Blockchain For Newbies…

Arjun Sasikumar
6 min readDec 30, 2018

--

So you might have been hearing the buzzwords blockchain, Bitcoin, cryptocurrencies, etc for quite some time now. Probably since a year.

What comes to your mind when you hear the word Blockchain ?

This ?

Photo by rawpixel on Unsplash

Or this ?

Or simply this ?

Photo by Mike Alonzo on Unsplash

Whatever it is, I will be putting it in a way that most you will be able to understand.

Many of us(geeks) have heard about Bitcoin through the dark web but never really bothered to look into it until last year when Bitcoin prices have skyrocketed for a short time and it made the headlines.

So what is Blockchain ?

Many of us commit the mistake of associating Bitcoin with Blockchain which is a very vague definition of what really Blockchain is and what it can offer the world.

It’s like defining the internet as the technology behind emails. Which is actually true but narrows down the scope of what internet really is and how it can disrupt the world we live in and impact our life so much.

So coming back to the point.

What the exactly is Blockchain….??

In geeky terms,

Blockchain is a decentralised technology and uses Distributed Ledger Technology (DLT) where the ledger is not stored on any centralised server.

Infact every system (also called as nodes) across various geographical areas participating in the network has a copy of the ledger and the data is synchronized and is accessible to anyone.

That’s it ???

So why is it such a disruptive technology ???

Let’s have a look at it in Layman’s terms.

The brilliance of Satoshi Nakamoto lies in how the DLT (Distributed Ledger Technology) is implemented.

Let’s start with the name Blockchain.

We can say that it is a Chain of Blocks

But what is a chain and what is contained in those Blocks ?

As I have said above, it’s a decentralised technology. i.e. no central authority like a bank is involved.

So how the transactions are facilitated and how can we maintain trust ?

Let’s understand this through Bitcoin’s Blockchain.

It’s a peer to peer network meaning all the transactions are done directly between two persons and no central authority like a payment gateway or bank is involved.

One of the most famous examples of a peer to peer network is the BitTorrent network.

So let’s take a network containing 6 nodes and all the nodes are connected to each other in a peer to peer network. Let’s call those nodes by the name A, B, C, D, E and F.

Photo credit ARJUN 😊

And every node has a ledger (A ledger is a book maintained for accounting purposes). For the sake of simplicity, let’s refer to it as paper.

So when A sends B, 2 Bitcoins (BTC), the details of the transaction like Sender address, Receiver address, Amount sent, Timestamp, etc. are recorded in the ledger.

Photo credit ARJUN 😊

To maintain trust across the entire network, the details are recorded not only in A and B’s paper but in every other nodes’ paper.

So even if B denies getting the payment, his request will be ignored since every other node in the network has a proof of the transaction. That’s how trust is maintained in the network.

In short, the entire system works on the basis of CONSENSUS of the nodes.

The word CONSENSUS is important.
We need various Consensus algorithms to achieve the stability and finality in the data on the blockchain.

A consensus algorithm is a process in computer science used to achieve agreement on a single data value among distributed processes or systems.Consensus algorithms are designed to achieve reliability in a network involving multiple unreliable nodes. … As a result, consensus algorithms must be fault-tolerant.

If 3 out of the remaining 8 nodes in the network stands with B and denies getting the payment, then also their decisions will be ignored as the maximum number of nodes agrees with A.

What if more than 50% of the nodes are against A ???

This is a question of 51% attack.
If 51% or more than 51% of the nodes are trying to write fraudulent transactions, then there is a problem in the network.

So certain consensus algorithms are made keeping the disadvantages of other consensus algorithms in mind.

We have various consensus algorithms like PoW (Proof of Work), PoS(Proof of Stake), DPoS(Delegated Proof of Stake), PoSpace (Proof of Space), PoET (Proof of Elapsed Time), etc.
I will be writing about consensus algorithms in my next story.

Coming back to the topic,

Just like A and B, if F sends 3.25 BTC to D, then even that transaction gets recorded in everyone’s ledger as the 2nd transaction.

Photo credit ARJUN 😊

Likewise, if enough transactions get recorded to fill up the paper, then a block gets formed. Various technicalities go into the formation of a block.

Inside a block, there are many pieces of information stored like block header which contains information like transaction root hash (also called Merkel Root), difficulty version, nounce (which is just an arbitrary value ), Timestamp and hash of the previous block.

image credits from ResearchGate.net

A block hash is calculated using the SHA256 algorithm and it is hashed twice.

If Alice sends a message “Hello World” to Bob, there is a chance that the message can be seized by an attacker and modify the message as “Hell World”. Now such a message can cause havoc.

Instead if Alice sends “Hello World” along with its SHA256 hash (hashing algorithm) which is “a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e”,
then Bob can verify the message he received from his end by computing it’s SHA256 hash. If both the hash matches, then the message got delivered intact. If Bob receives “Hell World”, then it’s SHA256 would be,
“c6b2498c30e92d69a54f3e9dd8cc1ee0d3b21b9512041988f48eb3be75f461a9”, which looks a lot different considering only one alphabet has been removed. Hence, Bob can find out the message has been tampered with.

The best thing about SHA256 is that if even small one thing in the message changes, the entire hash gets changed. Hence, data integrity is maintained.

Another property of SHA256 is that, if you hash just one alphabet or an entire series of Harry Potter novel, the resulting hash in both the cases would be of equal length.

Back to Blockchain,
Every block has is unique and it contains the previous block hash as it’s input.

The root hash forms a Merkel tree. Like the one pictured below. 2 transaction hashes are hashed into one hash. And it continues until a single hash (root hash or Merkel Root) is formed.

Here “H” stands for Hash function and “T” stands for transactions.

The hashing is done using a hashing algorithm called SHA256.

A block is formed roughly every 10 minutes and there are almost 500 transaction details in a block. The size of each block is roughly 1MB.

In short, every 10 minutes, a block gets “mined”.

This was a short explanation of Blockchain using Bitcoin’s Blockchain as an example. Suggestions and criticisms are welcome.
I will continue posting more and more interesting technical articles.

--

--