Overview
In the context of blockchain, a replay attack often occurs during a Hard Fork. If a user sends a transaction on Chain A, an attacker can 'replay' that same signed transaction on Chain B. Because the user's private key and the transaction format are the same on both chains, the transaction may be valid on both, causing the user to lose funds on the second chain unintentionally.
Prevention
- Chain IDs: Modern blockchains include a unique 'Chain ID' in the transaction data, so a transaction signed for Ethereum (ID 1) will be rejected by Ethereum Classic (ID 61).
- Nonce: Each transaction from an address must have a unique, incrementing number (nonce), preventing the same transaction from being executed twice on the same chain.