Blockchain: What goes inside?

Manav Vagdoda
3 min readJun 8, 2021

What is a blockchain?

As the name suggests, blockchain is a series of blocks all chained together with computationally impossible to defy cryptographic methods, containing data.

Source: https://www.istockphoto.com/search/2/image?phrase=blockchain

What does a block consist of?

A block consists of multiple attributes each serving its own use case, such as mining, hashing of data, and securing the block. Let’s go through them one by one.

1. The block number:

Each block consists of a number of its own, this number is one of the attributes included along with the data that goes inside the block. There’s nothing more to this attribute.

Note: Sometimes people use time stamps instead of block numbers.

2. The data:

Each block(as per the respective blockchain) has a limit to add data in one block, and accordingly we can add data into each block. This attribute is included with the block number and a few more attributes, into a cryptographic HASH function, to obtain a final HASH of the block.

3. The HASH of the previous block:

Assuming that the first block is initiated in our blockchain, which we call a GENESIS BLOCK. This block has its own HASH value, which is one the attributes that goes along with the data and the block number of our current block to be added on the chain.

Before we move to our final attribute, let’s talk about mining and proof of work.

Before any block gets added to the blockchain, we need to confirm whether the block that we’re adding is a valid one or not.

In order to achieve this, we have a concept called proof of work. What this means is that whichever entity can put up the most amount of computational work by following the protocols, gets to add the block to the chain. We call this process of adding new blocks, mining.

Let’s take an example:

Source: https://www.istockphoto.com/search/2/image?phrase=blockchain

Suppose that the GENESIS block number is 0 and the data it contains is “hello, Monday”. Since there is no previous block here, we do not need a previous block HASH and let us assume that this block was already mined.

The HASH value of this block will be: ebd8ba5af741735e271cb2f0c9994b3070be512fccf9702190864e33b2b60b09

We’ll use this HASH value as one of the attributes for our current block that has data as “hello, Tuesday” and it’s block number as 1.

So now that we have all our 3 attributes, let’s demonstrate how mining works:

4. The NONCE value:

This is any random numerical value that gets added along with the other 3 attributes which when entered into the cryptographic HASH function, it returns a HASH value that suits the requirements.

Those requirements can be like:

  • The first four bits should be all zeroes.
  • The last eight bits should all be ones.

Let’s assume that the requirements are that the first four bits should be all zeroes.

The cryptographic HASH function that blockchain uses is SHA-256 and there are no possible ways to predict what the resulting HASH will be.

Hence, the miners need to run all the possible permutations to get a NONCE value, which when added along with those 3 other attributes, returns us a HASH value that has the first four bits as zeroes.

Source: https://www.istockphoto.com/search/2/image?phrase=blockchain

The miner who was able to put up the computational work faster, gets to add that block to the chain of other blocks which later forms a blockchain and this process of adding new blocks is called mining of blocks.

In conclusion:

Together these blocks hold the HASH values for your data and are computationally impossible to alter. Corrupting one block data arises a need to computationally mine all the further blocks AGAIN, since one block is linked to its previous and following block as well. Hence, this makes it computationally impossible to alter the secured data.

--

--