Noting changes in the blockchain (part I). Corrupted data?!

Gepubliceerd op 19 september 2021 om 11:24

In addition to (attempting to) modify a transaction, a potential hacker may modify other elements of the blockchain. In this article I will discuss two ways the hacker can change the blockchain structure. I will also discuss the 51% attack. In the next part I will cover the other two ways. The second part will also deal with how data can be changed in a correct way.


The two elements in a blockchain structure that can be modified are the reference in the Merkle Root (see here for a more detailed explanation of the Merkle Root) and the replacement of a transaction. First, I'll discuss the change of reference in the Merkle Root and then I'll discuss replacing a transaction in a blockchain structure.

The figure below illustrates what happens when one changes not only the details (content) of a transaction, but also the hash reference that refers to the updated transaction. The hacker thus changes the 'link' (hash reference) between R2 and R12 (Merkle root).

The updated hash reference (R2) is valid because it correctly refers to the new transaction data (transaction 2). However, the updated hash reference is part of the Merkle root of which the root is also a hash reference. The root of the Merkle tree (R12) refers to a piece of data that contains the hash references R1 and R2. The latter has been modified to be consistent with the manipulated version of transaction 2. Hence, the cryptographic hash value of the data contained in the updated version of R2 also changes, which in turn invalidates the Merkle root R12.

Changing a transaction and the hash reference in the Merkle tree invalidates the root of the Merkle tree (R12), invalidating the entire data structure.

The second way is to replace a transaction in the blockchain data structure. The hacker does not change a hash reference, but replaces an entire transaction (which in turn will change the hash reference). In the figure below, the hacker replaces transaction 2 with transaction 5.
As far as the consequences are concerned, both figures are identical (figure 1 and figure 2). In both cases, the root of the Merkle tree R12 will be invalid as a result of changes that have occurred within the Merkle tree (R2 has been replaced by R5 which has an effect on R12. And because R5 has a different hash reference than R2, R12 also changes). As a result, we can conclude that changing a transaction or replacing a transaction will have the same impact on the blockchain data structure. The manipulation will be detected in both cases and will invalidate the entire data structure.

What keeps recurring is that not only the blocks holding the transactions are linked to each other, but also that the entire technique in a block is linked to each other by means of the hashing technique. If the hacker wants to change anything, his actions will invalidate the entire blockchain data structure. The nodes (users in a blockchain) notice this and know that the information in the blockchain is no longer correct. Because every node has the same general ledger with all transactions, the node that has been hacked can be restored to the original situation without the manipulated data.
A complicated factor is what if the hacker does not know how to hack one node, but 51% of the nodes (computers) in the blockchain (e.g. change/replace transactions). This is also called the '51% attack'. Hackers carry out a 51% attack to take over the blockchain. If someone (or a group) manages to control the network, they would be able to take control of the blockchain - for example - to redirect other people's transactions to their wallets.
In this article I have discussed two ways in which the blockchain data structure can change and become invalid. One way is to change the hash reference between R2 and R12 and the other way is to replace a transaction. Both situations have the same consequences: the hash reference R2 changes so the hash reference of the Merkle root (R12) also changes (thus invalidating the whole blockchain data structure). Finally, I briefly discussed the 51% attack, which gives the hacker control over the entire blockchain.
In the next part, I will deal with two other ways of making changes to the blockchain. I will also look at how data in the blockchain can be changed correctly.

I published this article previously on my LinkedIn page. This article was written on October 14 2020. This article was updated on September 18, 2021.

BTC address: bc1q3nnm8m2vrsv8med8a38dl37g8l3mm4wa7ph7wj 

ETH address: 0x38b84E2D3B50F83A067A7488C1733180651f418A

Reactie plaatsen

Reacties

Er zijn geen reacties geplaatst.