Analysis Techniques
Fuzzing tests a smart contract by executing it with large volumes of automatically generated inputs, trying to find values that break a stated property or cause a crash. In smart contracts, fuzzing is usually property-based: you declare what should always be true, and the fuzzer searches for inputs that violate it.
You write properties (assertions or invariants) such as "total supply always equals the sum of balances." The fuzzer then generates and mutates inputs — sometimes guided by coverage feedback — to try to falsify them.
// A property a fuzzer tries to break
function invariant_totalSupply() public view {
assert(token.totalSupply() == sumOfAllBalances());
}
Echidna and Foundry's fuzzer are common EVM fuzzing tools. Fuzzing pairs well with static analysis and symbolic execution.
Q: What is property-based fuzzing?
A: You define properties that should always hold, and the fuzzer generates many inputs trying to violate them, reporting any input that does as a counterexample.
Q: Does fuzzing prove a contract is safe?
A: No. It increases confidence by testing many cases but cannot prove the absence of bugs. Combine it with other techniques and manual review.
Related terms
Firepan
Run a free surface scan — results in minutes, no credit card required.
Run Free Scan →