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
- 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.
- Sign messages with nonce and address of the contract.
$ forge build
$ forge test
$ forge fmt
$ forge snapshot
$ anvil
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
$ cast <subcommand>
$ forge --help
$ anvil --help
$ cast --help