1

I will describe my question using an example.

Let's say the network is working on adding block #100 to the blockchain. An attacker recreates block #99 with a combination of transactions that are "legit", meaning that they can be hashed to the same hash that the actual block #99 is using (and there is no double-spend).

Then, he broadcasts the block to the network. How does the network know that this block is fake and rejects it?

I think it has something to do with PoW, but I'm not 100% sure. Can someone explain to me the process of rejection with a detailed explanation?

Thanks in advance for any answers!

1 Answer 1

0

In your example, if block 99 actually did hash to the same exact value (infinitesimally unlikely), then there is nothing that distinguishes it from the actual block 99, so it would not be considered fake, and would not be propagated because it already exists in the inventory vector. The property of the hashing functions used to create the block hash would prevent this because without the same exact data, it will not result in the same block hash. See Digital Fingerprinting.

The block hash is created by creating a hash of all of the transactions (using a merkle tree), and hashing that along with the other meta data in the block header. Changing a transaction (even just the order of the transactions) will change the merkle root, and thus change the block hash. See https://en.bitcoin.it/wiki/Block_hashing_algorithm

4
  • The fact that it is infinitesimally unlikely, doesn't make it 100% unlikely to happen. If it happens, the blockchain will have two variations. How will wallets know which one is the correct in order to calculate balances?
    – evannemo
    Commented Aug 22, 2019 at 14:00
  • the block would be ignored because another block with the same hash was already seen by the nodes. Updated my answer, see bitcoin.stackexchange.com/a/38385/60443
    – JBaczuk
    Commented Aug 22, 2019 at 14:08
  • Just answer me this and you get the correct answer mark. If they have the same hash, how does the network know which one is the valid one? If the attacker runs a full node, he can make a copy of the blockchain which includes the spoofed #99 block. He can then make a website where others will download the blockchain copy and if the original block #99 and the spoofed #99 one have the same hashes, then the spoofed one will pass any validation checks if sent to other honest nodes. Am I wrong?
    – evannemo
    Commented Aug 22, 2019 at 14:12
  • No, that is correct. As I mentioned, it is indistinguishable from the correct block unless that node has already seen a block with the same hash. But, as I mentioned, a SHA256 collision is basically impossible, and would not happen given billions and billions of years, so it is assumed that it will never happen.
    – JBaczuk
    Commented Aug 22, 2019 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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