paint-brush
Blockchain — A Short and Simple Explanation with Picturesby@adil
40,636 reads
40,636 reads

Blockchain — A Short and Simple Explanation with Pictures

by Adil HarisJanuary 5th, 2019
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

A Blockchain is a method of storing data. Data is stored in blocks which are linked to the previous block.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coin Mentioned

Mention Thumbnail
featured image - Blockchain — A Short and Simple Explanation with Pictures
Adil Haris HackerNoon profile picture

A Blockchain is a method of storing data. Data is stored in blocks which are linked to the previous block.

But what does a “Block” look like?

Each “block” contains

  1. Data of transactions
  2. A unique fingerprint for all the data in the block called a hash
  3. A hash of the previous block’s data

What do each of these items mean?

Data in the block usually consists of transactions. A block can contain hundreds of transactions. Alice sending Bob $100 is an example of a transaction in a block

A hash is a unique combination of letters and numbers. It is like a fingerprint for the data in a block and it is always unique to every block in the Blockchain. When the data in a block changes, the hash will also change.

Hence in a transaction, if the amount being sent Alice to Bob changes from $50 to $100, the hash of the block will completely change.

A block also contains the hash of the previous block. Hence forming a chain structure. Combining the above three together, this is what a Blockchain will look like

Now if a transaction in any block changes, the hash of the block will change. When the hash of the block changes, the next block will show a mismatch with the previous hash that was recorded by it.

This gives Blockchain the property of being tamper-resistance as it becomes very easy to identify when data in a Block has changed.

Hashes can be seen in action here. Try entering “Orange”, and then “orange”. See how a simple change in one alphabet completely changes the hash. Additionally, this link can be used to see how hashes secure the entire Blockchain.

Blockchain has one more property which makes them secure. A Blockchain is not stored on one person’s computer. Instead, it is stored in a large network of computers called a peer-to-peer network. A computer on this network is called a node, and every node will have a copy of the Blockchain.

Every a time a new block of transactions has to be added to this network, all members (nodes) of the network must check and verify if all transactions in the block are valid. If all nodes in the network are in agreement that the transactions in a block are correct, then the new block will get added to every node’s Blockchain. This process is called consensus.

Hence any attacker who tries to tamper with the data on a Blockchain must tamper with the data in the majority of the computers in the peer-to-peer network. This is how Blockchains proves to be a secure method of storing data.

Now, what if I wish to create a transaction in a Blockchain. How will I go about doing it?

Every computer software that uses a Blockchain, will give its users a public key and a private key. These are again just like hashes; they are a random sequence of alphabets and numbers that are generated by the software itself. Every user has to keep their private key securely and not reveal it to anyone. The public key, on the other hand, can be revealed to everyone.

Consider the example of a mailbox. The public key is like your mailbox which everyone knows about, and can drop you messages. The private key, on the other hand, is like the key to that mailbox. Only you own it, and only you can read the messages inside.

Both public and private keys have a unique property. The private key can be used to sign any message to create a digital signature. A digital signature is yet another sequence of characters and numbers. But there’s a catch!

All digital signatures can be verified using the corresponding public key. This means anyone who has a digital signature can verify whether a person truly signed the message, using the signer’s public key.

Both these keys, combined with message signing to create digital signatures can be called the cryptography in Blockchains.

Too complex?

Let’s break it down step-by-step with an example.

Alice wishes to record the message that she sent $100 to Bob on a Blockchain.

1. She writes the message and signs it using her private key to create a digital signature. Her message combined with the signature is a transaction.

2. The software Alice uses broadcast her transaction to everyone in the peer-to-peer network

3. Everyone in the P2P network first verifies her transaction signature, to see if Alice is the one who really signed that message. They do so using Alice’s public key which everyone knows.

4. Once verified, the P2P network includes Alice’s transaction on a block in a Blockchain.

5. When the P2P network reaches consensus, after verifying all transactions, the block with Alice’s transaction gets included in the Blockchain!

Once included, Alice’s transaction cannot be changed by anyone so easily!

And there you have it. That is a near complete explanation of how data is stored on a Blockchain

To summarize,

1. A Blockchain is a method of storing data in blocks which are linked together in the form of a chain.

2. It relies on hashes and cryptography to secure the data inside a block.

3. This chain of blocks resides on all computers in a peer-to-peer network.

4. This network of computers use consensus methods to verify transactions in a block and include a block on the Blockchain.

Hope you learned something new. If you enjoyed the read, kindly clap and follow me on Medium.

If you wish to know more about Blockchains or you happen to be in the market for a Blockchain expert for your project, book me for free for a quick 30-minute online consulting session. I have a new initiative called Consult Me Live which will facilitate this.

Cheers.