2

I'm not sure I understood everything but all the clients always keep the longest chain, ok. So, what happens if an evil person injects bad transactions in a block and successfully mine it (given the difficulty, the probability is extremely low, but let's imagine), how is the network gonna answer?

1 Answer 1

3

The rule is that the longest* valid chain is considered the active one. If you build a forking branch with invalid transactions in it, the network (in particular, all full nodes - including miners) will simply ignore it. If it's invalid, it does not exist. Blocks are not relayed to peers before validating them entirely.

You may be able to temporarily fool lightweight clients that don't do full validation, but to build a chain with sufficient length to "confirm" these invalid transactions requires sustained high hashrate, assumed to be impossible without significant (close to or above 50%) mining power.

longest* = it's actually the branch with the highest estimated total number of hashes that is considered the active one (as a tie breaker), not the longest one. This only very occasionally makes a difference (in particular, when the fork crosses a retarget).

10
  • Ok thanks for your answer. When you say "the total number of hashes", you mean in the last found block or in the whole blockchain?
    – heyo
    Commented Jul 22, 2014 at 23:08
  • In the whole blockchain. Fun fact: that number recently surpassed 1 yottahash (a 1 with 24 zeroes). Commented Jul 22, 2014 at 23:11
  • another question: when are the transactions checked? When the block is found, when the emitter of the transaction sends it to other nodes or the both?
    – heyo
    Commented Jul 22, 2014 at 23:11
  • Every node validates it before sending it to other nodes. Commented Jul 22, 2014 at 23:12
  • 1
    Adding the same transaction again in a block within a block chain that already has that transaction is a classic double spend attempt, and simply makes the block invalid. No node or wallet in the network will accept it. Commented Aug 14, 2014 at 17:50

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.