Solidity error handling, by gas cost:
โข `require(cond, "msg")` โ ~50 gas per byte in the message string
โข `revert SomeError(arg)` โ ~22 gas per call + a 4-byte selector
Etherscan decodes named errors with their args. require strings are just opaque bytes in the revert data.
Challenge 1: Crowdfunding.
The exercise:
โข Write a campaign contract with a goal and a deadline
โข Funders pay in, the contract holds ETH
โข On success: creator withdraws
โข On failure: funders get a refund