Before you go, check out these stories!

Hackernoon logoUnderstanding Blockchain by@arun.cthomas3

Understanding Blockchain

Author profile picture

@arun.cthomas3Arun C Thomas

During 2007–2008 financial crisis, some thing new was born which could possibly stop the next financial crisis. Some unknown programmer/ programmers called Satoshi Nakamoto came up with the concept of blockchain. In the up coming years first implementation of blockchain called bitcoin was realised. In this article we will be detailing more about blockchain, how it works and what is possible with it.

You can have a look at the actual white paper on bitcoin by Satoshi Nakamoto here. It mainly describes the approach and benefits of using distributed chain-of-hash based proof-of-work.

Blockchain as the name suggests is a chain of blocks. A block is a list of records which contains a timestamp, link to (hash of) previous block ,an optional nonce, an index, current hash and may be some data. Each block will be having the hash of previous block with it. The blocks are usually arranged linearly with time to form the blockchain.

So what about the first block? How is it created? It is a special kind of block called Genesis block. Its usually hard coded into the software. It will be treated with some special code as you can find here in bitcoin. The genesis block will not have a reference back to a previous block and it is used to initialise the blockchain.

Now that we have blockchain initialised you can add any kind of data to it and create a new block by following the standard mentioned by the protocol. The blocks can exist in more than one node (a system which runs blockchain) and new blocks can be added to any one of them. Before adding new data it will be synchronised with other nodes to find if new nodes have been added. Then the blockchain can be updated with longest available chain. When a new block is added to a node it can broad cast the same information to other nodes so that they can be updated.

Now what if some one decide to create fake blocks and verify the transactions? Peer to peer networks are susceptible to Sybil attack. Basically the attacker will be able to reduce reputation of the system by controlling a fair number of nodes. In order to avoid this kind of attack a concept of proof of work is introduced. So now in order to add a new block into the block chain each node have to do a computationally expensive task. This serves as a proof of work. So the sybil attacker should have more computational power than the rest of the system to succeed.

The computation can be done by specialised nodes (or pool of computational power) which can be then rewarded. They are called miners in the bitcoin world.

So what is the computation that they are doing? For instance you can keep rules about the hash (a one way function) code generate for a particular block. They should start with 4 zeros. The nonce associated with a block can be varied until you find the hash that start with 4 zeros. But the hashing algorithms used will take a lot of time to calculate the nonce since small change in input of a hash function will make drastic changes in output. So this will do two things. First, the credibility of the system will be improved. Second, the rate at which new nodes are getting added can be controlled.

Once these blocks are added into blockchain, it can grow really fast. And imposes the challenge of going out of control ( means need more and more computational power to do calculation on them). The solution is some thing called Merkle tree which combines multiple transactions into one block and add it to the blockchain. This not only help to reduce the foot print of the blockchain but also helps to run nodes on smart phones, IoT devices and small laptops.

One of the important feature of blockchain is that ledgers created are immutable. Which means that, any block added to the blockchain can not be edited. One is only allowed to add new blocks into a block chain. If some tampering is done at any block it will make the entire blocks after it invalid. So block chain can be used to verify credibility of your car, house, your skills, or any other thing that you can imagine.

Blockchain can use internet to create a decentralised and distributed network. The main difference to notice here is that, the web is also designed over internet, but it depends on a middle man called server for trusted communications. On the other hand blockchain can allow you to communicate to any one with out involving a trusted third party. In fact the trust is part of the protocol itself.

Its distributed and decentralised which means all parties have complete information of all the blocks. Which allows you to transfer value and create completely distributed applications based on it.

Bitcoin is one implementation of block chain also Ethereum is a platform which allows you to create any kind of blockchain application. If you are interested you can write smart contracts with Solidity and get up and running.

You can build any thing with block chain and it is limited by your imagination. A global banking, end to end transport services, trusted medical records, distributed AI models, most trusted messaging app, next generation social network, etc…

Hope you learned some thing new.

Thanks for your time.


The Noonification banner

Subscribe to get your daily round-up of top tech stories!