_Follow along with the video lesson:_ --- ### Sig Replay Prevention We've learnt the ins and outs of how a signature replay attack is executed and what makes a protocol vulnerable to this exploit, but.. **_How do you protect against something like this?_** The simplest way to protect against a replay attack is to assure that the function being called includes some kind of mechanism such that it can only be called once. Common solutions include - adding a block nonce, or a deadline parameter which will cause any subsequent transaction calls to revert. ```js function sendToL1(uint8 v, bytes32 r, bytes32 s, bytes memory message, uint256 deadline){...} ``` There are a variety of things you could employ, but the root of the solution is the same: Utilize some form of one-time-use data within your function to prevent it from being replayed!
Learn about nonce-based protection against replay attacks in transaction handling.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Solidity Developer
Smart Contract SecurityDuration: 25min
Duration: 1h 18min
Duration: 35min
Duration: 2h 28min
Duration: 5h 03min
Duration: 5h 22min
Duration: 4h 33min
Duration: 2h 01min
Duration: 1h 40min
Testimonials
Read what our students have to say about this course.
Chainlink
Chainlink
Gustavo Gonzalez
Solutions Engineer at OpenZeppelin
Francesco Andreoli
Lead Devrel at Metamask
Albert Hu
DeForm Founding Engineer
Radek
Senior Developer Advocate at Ceramic
Boidushya
WalletConnect
Idris
Developer Relations Engineer at Axelar