Summary
OurbatchVerifyIdentities() function was stress-tested across 14 batch sizes with 3 iterations each on a Hardhat local network configured to match Ethereum mainnet parameters (30M block gas limit). The test deployed the full UUPS proxy stack identical to production.
Methodology
42 individual transactions across 14 batch sizes (1 to 500 identities), each executed 3 times for variance analysis. Tests ran on a Hardhat local network with Ethereum mainnet gas parameters (30M block gas limit, identical EVM execution costs). The full UUPS upgradeable proxy was deployed fresh per test suite, matching the production deployment pattern. Each transaction was verified by reading back on-chain storage to confirm all identities were actually written, not just emitted as events. Gas measurements come directly from transaction receipts.Key Metrics
75,518 gas
Gas cost per identity at scale (batch 350)
350 max proven
Largest batch that executed successfully (88.1% of block)
~397 theoretical
Absolute maximum before exceeding 30M block limit
Gas Usage by Batch Size
Green bars fit comfortably within a block. Yellow bars use over 50% of block gas. Red bars exceed the 30M limit and revert on mainnet.Block Usage %
Gas per Identity (Efficiency Curve)
Cost per Identity at Various Gas Prices
Test Results
| Batch Size | Avg Gas Used | Gas/Identity | % of Block | Status |
|---|---|---|---|---|
| 1 | 110,190 | 110,190 | 0.37% | Pass |
| 5 | 411,593 | 82,318 | 1.37% | Pass |
| 10 | 788,332 | 78,833 | 2.63% | Pass |
| 25 | 1,918,664 | 76,746 | 6.40% | Pass |
| 50 | 3,802,670 | 76,053 | 12.68% | Pass |
| 100 | 7,571,549 | 75,715 | 25.24% | Pass |
| 150 | 11,341,396 | 75,609 | 37.80% | Pass |
| 200 | 15,112,373 | 75,561 | 50.37% | Pass |
| 250 | 18,884,357 | 75,537 | 62.95% | Pass |
| 300 | 22,657,386 | 75,524 | 75.52% | Recommended |
| 350 | 26,431,352 | 75,518 | 88.10% | Risky |
| 400 | ~30.2M (est) | ~75,515 | ~100.7% | Reverted |
| 500 | ~37.8M (est) | ~75,510 | ~125.9% | Reverted |
Cost Estimates
Adjust gas price and ETH price to see real-time cost projections:Safety Margin Analysis
| Block Availability | Available Gas | Max Identities | Note |
|---|---|---|---|
| 50% (conservative) | 15,000,000 | 198 | Safe for congested network |
| 60% | 18,000,000 | 238 | Good margin |
| 70% | 21,000,000 | 278 | Good margin |
| 75% (recommended) | 22,500,000 | 297 | Best balance of throughput and reliability |
| 80% | 24,000,000 | 318 | Tight, may get deprioritized by builders |
| 90% | 27,000,000 | 357 | Risky on busy network |
| 100% | 30,000,000 | 397 | Theoretical max, will fail in practice |
Additional Findings
Gas variance is near-zero
Gas variance is near-zero
Across 3 iterations per batch size, the coefficient of variation was 0.0001-0.0012%. Gas costs are fully deterministic and predictable for any given batch size. There is no randomness in cost.
Invalid entries are gracefully skipped
Invalid entries are gracefully skipped
Batches containing invalid entries (duplicates, malformed data) do not revert. Invalid entries are skipped and returned in the
failedIndices array, while all valid entries in the same batch are processed normally.Calldata cost breakdown
Calldata cost breakdown
At 500 identities, calldata alone costs ~1,044,212 gas (80,324 bytes). This is a fixed L1 cost that cannot be optimized away. On L2s like Base or Arbitrum, calldata is the dominant cost factor instead of execution.
Identity Register
On-chain identity storage architecture
Customer Management
Customer verification workflows
