sha256
Question
How is the sha256 precompile used on mainnet and what input sizes are most common?
Background
sha256 (0x02) computes the SHA-256 hash of its input. The gas cost scales with input size: 60 base gas + 12 gas per 32-byte word of input.
Over the analysis period, sha256 was called 10.5 million times, consuming 931 million gas. It's #4 by call volume but only 0.5% of precompile gas — individual calls are cheap (avg 89 gas, implying small inputs).
Investigation
Gas distribution
Gas scales with input size, so the distribution shows what input sizes are most common.
View Query: precompile_sha256_gas_dist
Top callers
Note: The callers data below covers a smaller window (~6,000 blocks) because the self-join query needed to resolve parent contracts is too expensive to run over the full range. The gas distribution above uses the full 426K-block range.
View Query: precompile_sha256_callers
Takeaways
- sha256 is #4 by call count (10.5M calls) but only 0.5% of precompile gas
- Average gas per call is 89, meaning most inputs are small (1-2 words)