Replay Attacks

Published by Mario Oettler on

If a fork occurs and the chain splits into chain 1 and chain 2, funds are available on both branches. Also, the private keys are valid on both branches. This could lead to an attack called a replay attack.

If a user creates a transaction on chain 1 transferring 1 coin from its address A to address B it needs to sign this transaction with the corresponding private key.

But the owner of address B could take this transaction and its signature and propagate it on chain 2. Since the funds still exist on chain 2, this transaction would be valid together with the signature. Miners would execute it and transfer the funds to address B on chain 2.

The attacker (B) literally replayed this transaction on the other branch.

Software engineers need to take care of this attack when introducing a fork. They could require transactions to include a chain id.

Users can protect themselves by transferring their funds at least from one chain to another address they own.