What is BlockChain & Cryptocurrency – a simple explanation from bottom to top

What is BlockChain? In case you are too overwhelmed by all the hype around BlockChain & Bitcoin and want to understand it from a ground level. You are at the right place. Let’s start with the basics.

Every entity in this universe can be represented by numbers.

Be it the details involving sub-atomic particles of an element, or energy and gravitational forces, stars, planets; or for that matter, even humans.

The DNA is nothing but a set of codes made up of four chemical bases.

Time and again, people have thought of creating a universal system to assign a unique value to each of these entities in the universe. But the question is how do we come up with such a system that could provide a unique fingerprint to not only every transaction happening on this planet but also to things beyond humans.

The answer lies in an upcoming technology that has the potential to be a general purpose technology of our decade to fill the gap that we as humanity are suffering. The gap of trust.

Many people say that BlockChain in 2017s is what web was in the 1990s.

Is it true? Let’s leave that question to be answered by time. For now, let’s focus on understanding what BlockChain really is by starting from scratch.

SHA-256 Hash

Talking about cryptography, you must be knowing about the famous mathematician, cryptographer, scientist Alan Turing who played a great role in World War II by breaking Nazi Enigma machine that helped Allied forces get coded messages transmitted by Nazi High command for Nazi Army.

SHA-256 is one such (deterministic) cryptographic hash functions that take an input data (of any type) and returns a fixed length (256 bit / 64 characters long hexadecimal code) that serves as a unique fingerprint for the input data.

For example,

Input — Blank
SHA256 Hash- e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

Input — “hello world”
SHA256 Hash-b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9

Input — White paper on Bitcoin by Satoshi Nakamoto (creator of Bitcoin)
SHA256 Hash- dcbf274c34af14943917906e767259f7e01c05ceae4eebea39af3fd0bf32bbbd

You can use any SHA256 hash calculator for this purpose. Check — http://www.xorbin.com/tools/sha256-hash-calculator

A pretty good use of SHA256 cryptography is this famous tweet

https://twitter.com/wikileaks/status/787777344740163584?lang=en

How would this work?
John Kerry would have run the (controversial) file he had through SHA256 Algorithm to generate Hash Key.
If the hash matches with the one posted by Wiki-Leaks, he would know that the file with the WikiLeaks is authentic and it is not some false claims.

Block

This is how a Block looks like

Data consists of all the transactions that have occurred in the particular time frame depending on the protocol the BlockChain is working on (10 mins in case of Bitcoin).

Nonce — It is an arbitrary number whose value is set so that the hash of the block (input — data + nonce) will contain a run of leading zeros (say 0000e3st4… or 000000r3jg7…) depending on the difficulty of the network protocol (higher the difficulty, more the number of leading zeros).

Let’s try to understand the concept of Nonce with a hypothetical example. Consider input data as “hello world”.

Concept of Nonce

The initial difficulty of finding a valid hash is low (starting with 0). The iteration to find the correct nonce starts with 1 and keeps on going until we get the hash value starting with 0 for 243rd iteration.

Now, the difficulty is re-adjusted to find the hash starting with ‘00’. This is achieved at iteration 1389.

Again the difficulty is re-adjusted to find the hash starting with ‘000’. This iteration goes on. Now, if the goal is to find hash starting with 4 leading zeros, then we have to iterate up to Nonce = 18014 to find first such occurrence.

Difficulty level of Bitcoin

This is the concept of mining in BlockChain. (Explained later in detail)

It is important to understand that the Hash value is unique for the combination of a nonce and input data.

BlockChain

Having understood what is a Block, now let’s see what is a BlockChain. In simple terms, BlockChain is a Chain of Block.

BlockChain

SHA256 Hash of Blocks = SHA256 (Block # + Nonce + Data (Coinbase & Transaction Lists) + Previous Block Hash + Time-Stamp)

You’ll notice that each block points to the previous block using field previous hash. That’s how the blocks are linked to form a chain.

Distributed Ledger

You must have heard — “BlockChain is a distributed ledger”. That’s because the same chain of blocks is maintained at each participating node. As shown in the above diagram, the two Nodes A & B could be located anywhere on the planet; but, they’ll always be in consensus on the blocks. This is true for a BlockChain network as big as Bitcoin or Ethereum.

Now, let’s assume there were (say) 100 nodes maintaining the ledger (the chain of blocks). Out of these 100 nodes, 10 of them shut down and connect back to the network after some time. Once back, they need to pick an active chain. However, due to technological constraints (as these nodes can be anywhere around the globe), the nodes might pick different versions of the chain as the active chain.

However, the protocol ensures that the consensus is reached quickly and the longest chain (one with the most “work”) is picked as the active chain. This chain is replicated at each node.

BlockChain is immutable
Let’s understand how.

BlockChain Immutable – any change in data changes the whole chain

Say, a hacker changed the data in Block # 2 in Node A. This would result in changing of the Hash of the block, which would change the previous hash of the next Block (Block # 3). This would further result in the change of Hash of Block # 3.

The new hash would be not valid as they do not satisfy the required Proof of Work (of getting a target hash value with leading 4 zeros).

Now the hacker would require to mine (compute new Nonce) for each block to validate the hash of all the subsequent blocks.

However, by the time the hacker mines the subsequent blocks in Node A, the chain maintained at other nodes in the network ( in this case Node B) would become longer (more “work” means more blocks) thus would by-default render the chain maintained at Node A useless (as explained in the above section of Distributed Ledger).

BlockChain Immutable – Even if a hacker makes any changes and then again mine for Nonce to correct Hash of subsequent blocks, the chain at other nodes becomes longer

Data in the Block

By now, you would have a fair idea of what a BlockChain is. However, we still need to understand how the transactions are stored in the block.

The data is stored in the format of Coinbase and Transactions of Tokens. In the below illustrated example, (say) VG is the miner who mines the Genesis block (First Block) and gets 25 tokens as the reward. This is the coinbase transaction where the person is allocated 25 tokens as a mining reward. This is how money (in form of crypto-tokens) enters the system of BlockChain.
It’s only after the tokens are allocated, can VG send transactions to any other users.
This ensures the authenticity of transactions.

Coinbase & Transaction Data

How is a Block added?

In the last section, I explained the building blocks of BlockChain. Now let’s understand how a new block is added; or specifically, what is mining?

Mining in BlockChain

Updation of Ledger
  1. Collect all the list of valid transactions from the transaction pool. Build a block containing the transactions as data. Ensure the size of the block doesn’t exceed 1MB.
  2. Calculate Hash of the block by applying SHA256 Hash function —
    SHA256(Block # + Nonce + Data (Coinbase & Transaction Lists) + Previous Block Hash + Time-Stamp)
  3. Compare the calculated hash with the target hash and check if the calculated hash is less than the target. Example, if the target hash should have 4 leading zeros, a calculated hash (say) 0000e3b..is valid. Else, Nonce is incremented and this step is repeated with the updated hash (until the calculated hash is less than the target hash).
  4. Once, the miner finds the winning block (i.e. hash less than target hash), he updated all the nodes about the block. The nodes check (for a long check-list) the winning block and if more than 50% of the nodes agree, the block is added to the existing chain and the miner gets newly created tokens as mining reward.
  5. The ledger is updated for every node.
  6. With time, as nodes with more processing power join the network, the problem can be cracked faster. However, block creation time has to be 10 minutes (as per Bitcoin protocol). Thus the difficulty of the problem is increased for every 2016th block (approx 2 weeks). With increased difficulty, the number of leading zeros in target hash increases. This requires more computational power to find the right hash.

You can see live Bitcoin transactions (in crypto format)- https://blockchain.info/

BlockChain, as we understand, is an essentially a public ledger containing all the transactions. This ledger is maintained at each participating node. It’s like a shared universal truth.

What makes BlockChain Secure?

The question that should pop into our mind is if the ledger is public — What about the security of data?
There’s no reason to worry, as BlockChain uses the concept of Public-Private Keys to secure all the transaction. Let’s understand this with help of an example.

Public & Private keys are set of uniquely related cryptographic key (basically set of long random number)

Public & Private Key

Public Key is shared by everyone on a network; whereas, Private Key is kept as secret.

If anyone (even you) encrypt a file with your public key; only you can decrypt it with your private key.
If you encrypt a file with your private key, then anyone can decrypt it with your public key.

When your friend send you bitcoins (or any cryptocoins) over BlockChain, they are sending you hashed version of your Public Key, which is basically your address.
But it is signed by your friend using their Private Key so that you know that it has come from your friend (and also so to ensure no can alter the transaction).

But, the next question that should pop into your mind is how would you access the transaction if you don’t have your friend’s private key?

Let’s understand this situation and the solution with an easy example.

Say, M want to send a message to his wife W over BlockChain.

How Public & Private Key work for sending message
  1. M would encrypt the message with his Private key.
  2. M would further encrypt the resulting message with W’s public key.
  3. M receives the encrypted message and decrypts it with W’s Private Key.
  4. Since W knows the M’s public key, she decrypts the message using M’s Public Key.
  5. She receives the original message.

In this whole scenario, one has to make sure that he safeguards his private key. Else, if someone gets hold of your private key, they would be able to send your cryptocurrencies to themselves by verifying that transaction with your Private Key — in effect stealing from you!

Finally, the last attribute of BlockChain — Merkle Tree

We understand that the block that needs to be added to the chain should be less than 1 MB. How do we ensure that when there could be a huge number of transactions?

Answer — Merkle Tree.

The idea of Merkle tree is to allow you to verify the transactions included in a block, without adding each transaction in the block.

This is how it works. Let’s say there are 4 transactions that need to be added to a block.

  1. Rather than adding hash for all the 4 transactions, we first hash the leaves (transactions).
  2. We combine the hash of leaves and again run a hash function (on the combined hashed leaves) to create a first level branch
  3. We combine the hash of first level branch and then run hash function to get second level branch
  4. We go on until we get a single hash — the Root Hash

Merkel Tree | Source -https://bitcoinbook.aseemraj.me/cryptography/hashpointer.html

Thus, the Merkle tree creates a single value that proves the integrity of all of the transactions under it (without the need of adding all these transactions to the block).

Concept of Smart Contracts

These are IFTTT premise based programmable contract stored on BlockChain. Smart Contracts let you exchange money, property or shares based on a set of conditions (without the need of any central authority like Banks, Government Agency, Lawyer, Broker, etc). Ethereum brought the concept of Smart Contracts in BlockChain.

The smart contracts are revolutionary as it can create an autonomous decentralized system where we do not require to keep trust in a central authority to facilitate a contract.

Smart Contracts

The first real-world transaction using smart contracts was in September 2016. It was held by Barclays, Israeli tech start-up Wave and Irish dairy producer Ornua, which concluded an agreement on the supply of cheese and oil (for $100,000) to Seychelles Trading Company.

The process, which usually takes from seven to ten days, took about four hours without the need for any third-party verification.

Now, having understood how BlockChain works under the hood, lets now focus on the business implications of BlockChain.

To start with, we should understand that there are two types of BlockChain Implementation.

Public BlockChain — an Open & Anonymous (Trust-less) network in which anyone can participate. However, this kind of network would have limited value if there is no network effect.
Example Bitcoin, Etherium, etc.

Private BlockChain — a Trustful network formed by a consortium of Enterprise (to solve a particular use-case to generate shared value for themselves). The admission to this network is restricted.
Example, R3 CEV developing BlockChain solution for a consortium of Banks (using Corda), Colu, OpenChain, HyperLedger, Chain and many more.

Enterprise BlockChain Source – https://magnr.com/blog/technology/private-vs-public-blockchains-bitcoin

Private BlockChain built with public-based architecture
Ripple is built with a public-based architecture but is privately controlled through centralized ownership to facilitate foreign payments between participating banks. It greatly reduces the operational cost of foreign remittance by providing a trusted & controlled BlockChain network to facilitate transactions (using Consensus protocol rather than Proof of Work protocol).

What makes BlockChain revolutionary?

  • Decentralized & Open
  • Immutable
  • Secure
  • Auditable — Transactional verification without central authority
  • Protection against Single point of Failure

What can BlockChain do for Businesses?

  • Facilitate instant Multi-party transactions — the best examples are from banking & payments industry — Ripple
  • Eliminate Costly Intermediaries — We are seeing usage of BlockChain in various domains as Ad-Buying (AdChain, MadHive), Loyalty (Loyyal), Music (Ujomusic, Peertracks), Content Distribution (Publiq), Advertising (BasicAttentionToken)
  • Enable Decentralized Trust — Used in Retail (Open-Bazaar), Transportation (La’Zooz), Social Media (SocialX.network, Steem.io)
  • Compliance in Supply Chain — Counterfeit protection by Alibaba Taoprotect, Walmart BlockChain implementation for Pork Compliance, Diamond Compliance by Everledger
  • Security & Tamper-proof records — Examples are Identity management (Block Verify, Civic), Health Industry (BitHealth, Nautica)

Though it is early in the development of Blockchain, the potential for incorporating the technology into almost every industry is endless.

Sharing Economy (Airbnb, Uber, OLX, etc), Crowdfunding, Governance, Supply Chain Auditing, File & Data Storage, Prediction Markets, IP & Copyright Protection, AML & KYC, Banking & Financial Markets, Health Industry, Advertising & Marketing, Land Registration and what not!

Credits – The article is inspired by the session on “Cryptocurrency & BlockChain” by Prof. Bhagwan Chaudhary (conducted by Indian School of Business).

LIKE & SHARE if you found this article useful.
It gives me 🔋 to write knowing people find value in it.   

Share & Help others find the resource

Leave a Comment

Your email address will not be published.