2

Let's say we have a Blockchain consisting of 10 blocks, indexed from 0(Genesis Block) to 9(The last block).

If the data of a block, say block 5, is changed(maliciously), the data stored on the block, as well as subsequent blocks, becomes invalid.

What happens next?

It is impractical to drop the blockchain entirely. It is also impractical to recalculate all the hashes, in case of larger chains.

So, how is data of the current block, as well as that of other blocks, preserved in the event of an attack on a single block?

  • What do you mean with "data of a block is changed"? Do you mean one node maliciously changes its block data? – Lauri Peltonen Aug 17 '18 at 8:17
  • @LauriPeltonen Yes, that's exactly what I mean to say. – Susmit Agrawal Aug 17 '18 at 8:27
  • 2
    I highly recommend this video: youtube.com/watch?v=bBC-nXj3Ng4. – user19510 Aug 17 '18 at 8:31
  • @smarx Thanks a ton for the video! It really cleared up several concepts! – Susmit Agrawal Aug 17 '18 at 9:08
3

Please note that I'm not 100% fluent with blockchain details but the basic idea in this answer is correct and probably most of the details are also correct.

If one node changes its history data, not much actually happens. All other nodes still contain the correct data and all subsequent hash values represent the correct data. Even the one node with incorrect history data might not even notice it and continues with correct hashes for the correct data even - I don't think a node revalidates its own history. As for the whole network, consensus data is correct.

I think the only problem might arise if someone queries your malicious node for history data and gets the incorrect data. They could just check whether the data is consistent with future hashes and notice it's not, but I'm not sure if clients actually bother with this kind of checks. If a single node is malicious it can probably succeed in providing you with malicious data.

But, still, the network as a whole wouldn't probably even notice the malicious data and the malicious data wouldn't even be available anywhere else except the one malicious node.

  • One question here: As far as I know, a wallet is not decentralised. Rather, it uses the data on the node for transactions. What prevents the use of malicious data from affecting these transactions? For example, if a node has 0 ETH in other nodes, and 10 ETH in itself, what prevents any transactions from being carried out? – Susmit Agrawal Aug 17 '18 at 8:53
  • Even if I have 0 ETH everywhere I can submit a transaction to send 5 ETH to some account. The transaction will be processed but it will fail because the balance is too small. Even if one malicious node accepts it, all other nodes will not and the one single node's result will be ignored due to consensus protocol. – Lauri Peltonen Aug 17 '18 at 8:56
2

Blockchain uses a data structure called Merkle Tree for efficient and secure verification of content in a large body of data. If a single detail in any of the transactions or the order of the transactions changes, so does the Merkle Root. Using a Merkle tree allows for a quick and simple test of whether a specific transaction is included in the set or not. Read this article to understand Merkle trees.

So if any node maliciously changes the data of block it's Merkle root hash will be different from the Merkle root hash of honest nodes. A malicious node could not reach a consensus for the changes that have been done by that node and those changes will be simply discarded by the blockchain.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.