Skip to content

Signing messages off-chain and having a contract that requires that signature before executing a function is a useful technique.

Notifications You must be signed in to change notification settings

Maheswaranx15/SignatureReplay

Repository files navigation

Foundry

Signature Replay

Signing messages off-chain and having a contract that requires that signature before executing a function is a useful technique.

For example this technique is used to:

  • reduce number of transaction on chain
  • gas-less transaction, called meta transaction

Vulnerability

  • Same signature can be used multiple times to execute a function.
  • This can be harmful if the signer's intention was to approve a transaction once.

Preventative Techniques

  • Sign messages with nonce and address of the contract.

Usage

Build

$ forge build

Test

$ forge test

Format

$ forge fmt

Gas Snapshots

$ forge snapshot

Anvil

$ anvil

Deploy

$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>

Cast

$ cast <subcommand>

Help

$ forge --help
$ anvil --help
$ cast --help

About

Signing messages off-chain and having a contract that requires that signature before executing a function is a useful technique.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published