modexp
Question
Who is driving modexp usage and what does their call pattern look like?
Background
modexp (0x05) computes modular exponentiation: base^exp mod modulus. Gas cost scales with the size of the inputs (base length, exponent length, modulus length), making it a variable-cost precompile where gas per call is a direct proxy for input complexity.
modexp is the #1 precompile by both call count (25.3%) and gas (37.7%). Over the analysis period it was called 17.8 million times, consuming 71.2 billion gas.
Investigation
Gas distribution
Is modexp usage spread across many different input sizes, or is it one thing?
View Query: precompile_modexp_gas_dist
It's one thing. 98% of all modexp calls consume exactly 4,048 gas. Same input parameters, millions of times. The next most common value (500 gas) accounts for just 1.4%.
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_modexp_callers
One contract accounts for 94% of all modexp calls: 0x77e3ba096355510e0e9f60d292010b42d662d2b5. It's a ZK proof verifier with 364,000 opcodes that calls modexp as part of proof verification.
Tracing up from the verifier to the top-level transaction:
It's Aztec Network's ZK rollup, submitting epoch root proofs to mainnet. Each proof verification transaction calls the verifier, which does exactly 277 modexp operations as part of the proof math, plus BN128 curve operations (ecAdd, ecMul, ecPairing).
Calls per transaction
Grouping modexp calls by transaction confirms the pattern.
View Query: precompile_modexp_per_tx
The spike at 277 says it all. The vast majority of transactions containing modexp calls make exactly 277 of them. These are Aztec epoch proof submissions, about 1,100 per day.
Takeaways
- modexp is #1 by both call count (25.3%) and gas (37.7%)
- 98% of calls hit the same gas value (4,048) — this isn't diverse usage, it's one protocol's verification loop
- Aztec Network's ZK rollup accounts for ~94% of all modexp usage
- Each epoch proof does exactly 277 modexp calls at 4,048 gas each
- Aztec submits ~1,100 proof transactions per day, burning roughly 1.2 billion modexp gas daily
- Repricing modexp (e.g., EIP-7883) would land almost entirely on ZK rollup verification costs