Blockchain explained – Part 2 : Structure

This is the second part of the ‘Blockchains explained’ series. Here’s the first part.

While the first article was about the main idea behind blockchain, in this article, we’ll look at the very basic structure of a blockchain in more depth.


Hashing, in the context of cryptography, means transforming any written strings / numbers into some other meaningless characters with the help of some algorithm.

Lets look at a very simple kind of hashing ; Lets say a hashing algorithm changes strings into numbers which is their position in the alphabetical order. Like A will be changed into 1, D will be changed into 4 and Z will be changed into 26. And if there is some number or some other special character, it will be changed into the letter ‘j’.

So hashing the name ‘Alex 69’ with this algorithm, we get ‘112524 jj’. Here A gave us 1, L gave us 12, E gave us 5 and X gave us 24. And the number 69 will be changed into ‘jj’ as we have already specified, how any characters other than alphabets will be changed into ‘j’.

Now this is a very simple kind of hashing, there exist more, which are way more complicated than this one. The most famous is the SHA256 algorithm. Hashing must always be hard for someone to decode. It must be irreversible.


A block mainly stores 3 things – the data, something called a nonce and a hash. The data could be anything, a nonce is a special character we will be talking about in a moment. And both the data and the nonce gives out the hash.


A nonce is a character which basically sets a difficulty level or a rule for a hash. And if this difficulty is not met, the block becomes invalid. For example assume I want the hash of a block to have ‘123’ at the start. Probably it won’t always be possible after hashing out the data. So a nonce is generated in order to get the desired hash. Basically, After the data is hashed, and this hash is rehashed after adding a nonce in front of it, we get the hash according to our need, starting with ‘123’. Making our block valid.

The process of finding this nonce is called mining.

Hence if I change something in a block, which is most probably the data, the hash would change and most probably this hash won’t satisfy the rule making it invalid. So I need to mine it find the new nonce to make it valid again.

Blockchain Demo by Anders Brownworth is an amazing tool you play with to understand this and the following concepts better.

The Blockchain itself

As many of you might have guessed, a blockchain is just a series of blocks we discussed above. Along with that, each block in this series also contains the hash of the previous block. Also the hash of each block depends on its prev. hash value too. So if we are talking about a block in the chain, its hash is dependent on the data, the nonce and the previous hash.


Notice how the first block has prev. hash 00000 as it has no previous block, that’s why it is referred as genesis block. Also notice how the link is being made by the prev. hash entries. This is in fact why we call it a chain.

Alright here’s a question, can you spot the mining rule here ?

Well as many might have guessed easily, it is that our hash should have ’12’ at the start.

Now what if I were to tamper with anything in any block ? Lets say I changed the Data of second block. Probably it will change the hash too. And now this will change the succeeding block’s (third block) prev. hash too. Causing a change in this block’s hash too. And this will repeat till the end of the chain. And this will change every block’s prev. hash after the first one making each invalid as now the hash will probably not be having ’12’ at the start. So to make it valid again, I need to mine the block I tampered first, and then mine all that succeed. And this will of course be time consuming.


Now imagine if I have different copies of a blockchain(imagine it has 1000 blocks). Lets say I have 50 copies. Now someone tampers with one of the copy, lets say he decided to change the data from the second block, and now he is going to the usual process of mining each block after that so I don’t recognize his activity. And…

blockchain meme

he’s finally done………….

He has mined each block and successfully flagged each one as valid. So did he also successfully fool me to think that whatever my blockchain has , has never being tampered.

Of course he did not. I am still having other copies. I can easily notice if there is any tampering by looking at my copy’s last block’s hash. If it has different hash from the other copies’ last block, I can deduce that, someone has changed something in my copy and at the same time mined it so it looks valid.

So for a tamperer or someone, it will become meaningless to change just one copy, he must do that with at least more than 50 % of the rest copies too. So his change is accepted by the majority. And to make it completely unnoticed he has to do the same process in all the copies. Quite a commitment that is.

Now you get the idea of why blockchain technology is way more secure than tradition server based systems

  • To change the data of a blockchain, one must mine a lot
  • They also need to change it for most of people in the network in order to actually make the change affective.

How it is in the Real world ?

In the real world, the Data we just talked about could be anything. In the context of cryptocurrency, which is just an application of blockchain technology, this data could be about different transactions.

The hashing algorithm will probably be something more ridiculously complex. Like the famous SHA256 algorithm. The mining rule, must be more complex.

In the next part I’ll be talking about the role of cryptography used in blockchains. Or you can say about public and private keys.