The hidden gas costs of common Solidity patterns
Every SLOAD, SSTORE, and external call in your Solidity contract carries a precise price tag — and most developers dramatically underestimate the cumulative cost of common patterns. A single cold storage read costs 2,100 gas, a zero-to-nonzero storage write costs 22,100 gas, and a cold external call adds 2,600 gas overhead. These numbers, reshaped by EIP-2929's cold/warm access model, EIP-1153's transient storage, and EIP-4844's blob transactions, define the optimization landscape for 2025. Understanding them is the difference between a contract that costs users $5 per interaction and one that costs $0.50. This report compiles precise gas cost data, benchmarked anti-patterns, optimization techniques with concrete savings numbers, and L2-specific considerations that experienced Solidity developers need to write efficient contracts today.
Tags
Explore More Security Topics
Browse our comprehensive wiki for more blockchain security knowledge.
View more Fundamentals articles