January 29, 2019 Knowledge Center

Understanding Immutability in the Blockchain

Immutability is a word that has become synonymous with the blockchain. The dictionary defines immutability as “unchangeability.” The word refers to the blockchain characteristic that any data written into the blockchain cannot be altered or modified.

An excellent example to understand it better is to compare it with a Google spreadsheet. The latter has rows and columns which you can add, edit, or delete anytime you want. On the other hand, when you enter any data into the blockchain, you cannot touch it unless there is a consensus agreement. Therefore, while the data inside the blockchain is not 100% immutable, there are vast complexities involved in changing it.

What Does Immutability Mean in the Blockchain?

If the blockchain is not entirely untouchable, why is it called immutable? To avoid confusion and misunderstanding, we need to talk about two words that are closely related to immutability – tamper proof and tamper evident.

When something is tamper evident, every little change and modification done will be noticed by everyone. Tamper-proof, on the other hand, means the object is truly untouchable.

It can be impossible to find things that are tamper proof because almost all things are susceptible to change. However, some are much more difficult to change than others.

One example is the toothpaste. When someone squeezes out some toothpaste out of the tube, the evidence of somebody doing it is undeniable. No matter how hard you’ll try to put the tube back into its former condition, it is difficult.

That is what tamper evident is all about. Although you can touch or change something, it will be hard to do it because the changes that have been done are very apparent. The blockchain is the same; therefore, we can say that the blockchain is tamper evident rather than being tamper proof. Because of this, any data stored in the blockchain is considered secure and legitimate.

How Does Immutability Work in the Blockchain?

Now that we have established that the blockchain is immutable because it’s tamper evident, the next question is: up to what degree is the blockchain immutable?

To understand how immutability works, we have to talk about the hash. The hash is a set of mathematical operations that create a digital signature (also called a checksum). It works like your real signature, but instead of paper, you append the digital signature on any digital data.

Most modern programming languages have a variety of hash functions. One of them is the Secure Hash Algorithm 2 or SHA-2. Under this hash function, there are more types of implementations, the most popular of which is the SHA-256. Try to input a group of bytes, and a hash function will churn a unique checksum.

As an example, let’s use these three lines of Python code, which has access to the SHA-256 and other SHA-2 implementations. Using this algorithm, we will input the string, “this is magic.”

>>> import hashlib

>>> h = hashlib.sha256(‘this is magic…’)

>>> h.hexdigest()


This hashlib will give you a string of 64 characters – nothing more, nothing less. No matter how small or big your input is, it will still produce a checksum with the same number of characters. To prove it, let’s input a much longer string:

>>> h = hashlib.sha256(‘humpty dumpty sat on a wall, humpty dumpty had a great fall’)

>>> h.hexdigest()


If you count the checksum, that’ll be 64 characters in all, but the checksum is unique from others. Uniqueness is one of the most notable properties of hash functions. Thus, even if you compute two files that look the same, you will find out if there are any differences when you compute their digital signature or the checksum. Even if the change is minimal and you cannot see it, the hashes will never lie and tell you the difference.

In the first hash input, “this is magic…”, the checksum is ‘49240b3cc693fd281422bbcabb5f207ae2a390003534989fb55080799ee08d8c’.

If you add another period to the sentence, it will have another result. Here’s the computation:

>>> h = hashlib.sha256(‘this is magic….’)

>>> h.hexdigest()


By adding an extra character – a period – to the string, it produced a different hash output. Another fascinating feature of the hash output is that it is “computationally impossible” to go back and determine what kind of input churned that unique output.

Even if you asked a seasoned developer to find out which input value created that, they’d tell you that it’s impossible. On the other hand, if you ask the same developer to give you an SHA-256 signature from the “this is magic….” string, he will provide you with the same value.

How Secure and Valid Are the Facts on the Blockchain?

The blockchain is made up of blocks of linked data, creating a chain. Each of these blocks consists of multiple transactions or facts. A software will compute the checksum of each block. The data fed into the calculation comprises of a myriad of information that includes the checksum of the previous block and the present block. These factors will all be included in the calculation of the new block, and this is the reason why rewriting the blockchain is almost an impossible feat.

Every time there’s a new transaction, it will go straight into a transaction pool, waiting to be written into the blockchain. If there are enough transactions, Bitcoin nodes will process each transaction to create a new block which will then be added into the chain. These become a permanent record in the blockchain.

The format of the checksum in the blockchain starts with zeros. Every time the checksum is recorded and added to the blockchain, more zeros will be appended to the hash output. If someone wants to alter the history of the blockchain and add a new transaction, that person had to go back to Block 1 and compute a brand new Block 1 hash output. Such a process will require a vast amount of computing power as well as time, money, and effort.