In recent times, this Blockchain technology elevated quickly. I hear people talking about Bitcoins and such cryptocurrencies when concerned about blockchain. But are they the same thing? What’s the need for blockchain in them? If you have these questions in mind, you’re in the right place.
If you are like “wait, what is blockchain and these cryptocurrencies are?”, go ahead and read WTF is the blockchain? It’s a great article to start off with Blockchain and Bitcoins. Also if you are interested, read Learn Blockchains by building one.

This article is intended to explain the need for blockchain in cryptocurrencies and what property of blockchain makes these currencies exist. So, Unless you’re introduced to Blockchains before, the following won’t make sense without reading the above two articles.

Traditional Currency

The foremost thing one needs to understand is how our traditional currencies work and how they got value. Take a look at the image below

50inr-note

The RBI Governor has signed that he promises to pay the person having this note a sum of fifty rupees. The paper gets it’s value from the trust people have on that promise. When you have this currency, the RBI owes you a fifty rupees and when you give to someone, the RBI owes him. And that’s the reason why the nation can’t simply keep printing notes.

Digital currency

With all these digital currencies, there is a central authority to manage the flow. Like RBI in the above case, Paytm owes you the sum, if you have it in their wallet. We keep on transferring the ownership.

Cryptocurrency

Now to Cryptocurrencies, they don’t have a central authority and that’s the advantage with them. If so, then the following needs to be addressed

  • Who owes us the money, if we have it as a cryptocurrency?
  • Where does it get its value from?
  • On whom the trust is upon?

No one owes you the money you have on cryptocurrencies. All the transactions are recorded in a public ledger and you can send money to others upto a sum you have received and not used. That means when you need to transfer a sum of 20, the network checks all your old transactions and you need to have received a sum more than 20 and not spent.

The Cryptocurrencies gets their value from the trust people have on its network. If there is a central authority, they would have the data of all the transactions and people would have a trust that they would pay how they owe. Here in cryptocurrencies, the people need to trust the network. The network should make people believe that the money there won’t vanish off and can’t be altered by anyone as it’s a public ledger. All these boils down to trust. The main challenge to these currencies is the need for them to gain the trust.

BlockChains

Blockchain solves this issue, the blockchains have all the properties that the cryptocurrencies need. They cannot be altered once written. All the nodes in the network will have a copy of the chain (ledger), so that no one owns control and no one can alter it. The problem of data redundancy kicks in as a single transaction needs to written on all the ledgers in the distributed network. Blockchains have a solution for this. The remaining part of this article is focused on how the Blockchain ensures integrity and how it solves the problem with data redundancy.

Data Integrity

The transactions once written on the ledger should not be modified. So, once you have received money it’s yours and no one can take it from you unless you send it to someone. If you have read the two articles mentioned above, then you would be aware of the Proof of Work and how a block is attached to the previous block. Each block would contain the hash of the previous one. So Anyone altering transaction in a middle of his chain would make the entire chain after that block to become invalid. And now he can’t participate in the network as his chain is different from the majority in the network.

There is a vulnerability here. What if majority of the people in the network support the person who is dishonest and change their chain in accordance with him. The entire cryptocurrency concept would fail. This is called 51% attack. But this needs the 51% of the people in the network to be dishonest which is impossible.

Solving Data Redundancy

The ledger is distributed over the network and every copy needs to be updated when a transaction is made. The transaction is broadcasted over to all the nodes in the network. The problem here is that the one you studied in the DBMS class — order of the transaction.

Each transactions are written in a new block which is not attached to the chain. The block is attached to the chain when it becomes full and a new block is created for further transactions. For the block to get attached a proof of work needs to be generated, which can only be done by solving a NP problem laid by the network in brute force. This needs a lot of Computing power.

Let’s do with an example, A has a credit of only ₹20 and he sends it to B. This takes time to get written on all the nodes in the network. The node seeing this will accept the transaction as A has the credit and writes it to it’s block. Now, if A sends another ₹20 to C before all the nodes are updated , the nodes that have written the first transaction will not accept it. But the nodes which receive the second transaction first will update its block and reject the first transaction when it receives. Now some nodes in the network have recorded first transaction and some have recorded second.

Then when the block becomes full, it needs to be attached to the chain, for this the proof of work needs to be generated. The node which solves the problem and generates the proof of work can attach its block and all other nodes needs to accept the block of that node which solved the problem. So the transaction of A which that node has written is only accepted and the other is rejected.
This is called Mining and the miners try to solve the problem so that they can attach their block next. They get rewarded in return too.

Conclusion

Thus the blockchain ensures data integrity even when the ledger is public and stored in all the participating nodes. This makes them the next gold.