What the heck is Blockchain?

Hack A BIT
hackabit
Published in
5 min readOct 18, 2019

And how is it related to bitcoin

The hype around blockchain is massive and ever-increasing.Blockchain technology is primarily being used as a distributed ledger(a multi-site shared and synchronised database) for cryptocurrencies most notably ‘Bitcoin’.Blockchain can also be used for

  • Stock Exchange
  • Transforming gaming experience
  • Decentralized Social Networks
  • Encrypted Messaging

And much more.

But what exactly is blockchain? Let us try to answer this question.

Blockchain comprises of the words block and chain.Correctly so because physically speaking blockchain can be described as a chain of blocks with ordered transactions.A block can have the following structure:

Now certain people may start to look at this as a database. That is correct as long as they are willing to believe that it has certain special properties like immutability and added security, but more on that later.

We will use a small story to understand how blockchain works. The analogy can be self-understood later.

Let us assume there is a group of 4 friends epsilon, alphaone, razer and Euler. Another one of their not so close friend kingzilla works at a bank.

Once alphaone was on a date with his girlfriend and was in desperate need of money. He asked Epsilon for help. Epsilon called kingzilla immediately to record a transaction of $1000 from his account to alphaone’s account. Kingzilla recorded the following transaction :

You see there can be two reasons for this error :

  • Kingzilla misheard Epsilon.
  • Kingzilla was actually corrupt.

You see this error could be avoided if kingzilla wasn’t in the picture i.e. they hadn’t used a third party for money transfer. From next time onwards they decide not to use kingzilla’s services.

The four friends have helping nature and have lent money to each other in the past. So one day everybody sits down with a piece of paper to settle their dues. Whenever somebody makes a transaction he shouts it out. Everybody records the transaction in their sheets. This is how everybody’s sheet should look like(if everybody heard everything correctly) :

For the next set of transactions, they decide to use a fresh page. But before that, they want to seal their pages inside a folder to keep the integrity of the information contained in it. The seal would be the same for everyone. So anybody at any time can verify the contents of a page. Also, the seal would be a way to check if the information inside has been modified by someone.

To handle the above transactions blockchain uses something known as a smart contract. A smart contract is an agreement between two people in the form of computer code. They run on the blockchain, so they are stored on a public database and cannot be changed. The transactions that happen in a smart contract are processed by the blockchain, which means they can be sent automatically without a third party. Smart contracts are written with the help of the Solidity programming language. Below is a snippet of what the smart contract for the above transaction would look like.

HOW TO SEAL?

Refer to this article for learning about hash functions.

Speaking in naive terms, a hash function is a black box that generates a unique value depending on the input. Note that given an output it is a difficult task to calculate the input but given an input and an output, it is easy to verify if the input generates this output.

We will use the following formula for generating our seal :

hash(list of transactions + sealing number) = a special number

Now each of the friends has the list of transactions and the special number. They will all do a computationally extensive task to calculate the sealing number. Somebody will do it faster than others and shout out the sealing number. Others can just verify if the sealing number is correct. If the majority agrees on the sealing number, it is finalized. What benefit does this somebody have then? One could simply wait for somebody else to calculate the sealing number for them.

This is where cryptocurrencies in the form of awards come in.The individual to calculate the sealing number fastest and correctly gets awarded with cryptocurrency (like Bitcoin).

In real life too people can communicate using common ground and record their transactions digitally. They can also keep an encrypted profile if required. The pages of every individual can be put in a folder and the folder can have a sealing number as the password. Only a person with the correct sealing number can look into the folder. But, what if Euler goes corrupt and decides to change the values of a transaction on everybody’s page? He could always change the contents, calculate a new sealing number and put it as the password of the folder.

This is where chaining comes in!

To ensure that the contents remain immutable we change our hash function a bit.

hash(list of transactions + previous sealing number + current sealing number) = a special number

Think about this for a while. You see for changing the contents of a folder you’ll have to change every folder prior to it which is a nearly impossible task. A case where this could occur is if the entity decides to create a branch from the chain. The principle then used is :

The longest chain is the correct chain.

All curious minds would have already figured out that corruption could still creep in if more than 50% of people are corrupt. That is in fact true and is known as a 51% attack. But then, blockchain works on the principle that the majority of the crowd is always honest.

That is a small description of how blockchain works. I have used several medium articles for reference none of which were less informative than the other.

Further reading: https://medium.com/search?q=blockchain

Aditya Jha

jhaaditya1998@gmail.com

Ranjan Binwani

ranjanbinwani@gmail.com

--

--