1

I am reading the book "Mastering Bitcoin" and have finished reading Chapter 2 and 10, but I still don't find the answer.

Suppose the current main chain has 5 blocks:

B0 <- B1 <- B2 <- B3 <- B4

As new transactions flowing in, the honest miners are mining B5, the 6th block.

If I publish a modified B2, say B2', to the Bitcoin network, what happens to this modified block when it is received by the other peers? Suppose B2' contains all the transactions that B2 has except that the amount of transferred bitcoin of one transaction is slightly modified but still a valid amount.

  • Would B2' be rejected immediately? It doesn't look like so because the modified transaction seems to be still valid. As far as I have learned, the recipient node uses the earlier blocks, B0 and B1, to validate B2', and I think the validation would succeed. Am I right?
  • If B2' is not rejected immediately, would the peer nodes link it to B1 as a secondary chain? I actually think B2' should be rejected but after reading Chapter 10 of Mastering Bitcoin I don't seem to find a reason to justify why it should be rejected.
  • Furthermore, if B2' is linked to B1 anyway, what would happen when the 6th block, B5, is now mined and published? According to the Chapter 10, "the transactions ... are re-inserted in the mempool for inclusion in the next block, because the block they were in is no longer in the main chain." so I think now B2' would be removed and its transactions would be re-inserted into the mempool. Then all the unmodified transactions in B2' will be removed again because they have been included in B2 in the main chain, and the modified transaction in B2' would be rejected because it conflicts with the counterpart in B2.

Thanks for any help!

2

Nodes would reject it immediately.

If you simply alter the data of B2 and send it, the block will be invalid by definition as the proof of work and merkle tree will not be valid anymore.

If you modify the data and rebuild the merkle tree and redo the proof of work to produce an alternative, valid B2' (note that everything else in this new block must also be valid, including transactions), nodes will still reject it as the chain going up to B4 has a greater amount of work.

Nodes will consider the chain with the greatest amount of total work as the valid chain. If you want to rewrite history, you will need to mine a new chain going back to the block you want to start rewriting from, and mine it to a point where its total work exceeds the current best chain. If you then broadcast this new chain of blocks, it will cause nodes to perform a reorganization, and drop the previous chain.

As for transactions returning to the mempool, that does happen in the event of a reorganization. All transactions from the dropped blocks are returned to the mempool. Usually, since miners generally pick similar transactions, the new blocks replacing the old ones will confirm mostly similar transactions, so the mempool will usually only be slightly different at the end of it.

  • Thanks for the answer! For anyone's information: I happened to come across the article "Blockchain: how a 51% attack works (double spend attack)" which does say that the malicious user must grow a long enough chain in order to make the reorganization happen (see the "Stealth mining" section). – yaobin Oct 20 '18 at 18:25

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.