What Interviewers Really Want to Hear
First off, they're not just testing your memorization - they want to see if you understand the why behind gas costs. Here's the framework I always use:
"Gas costs reflect computational complexity and state impact" - lead with this concept, then dive into specifics.
The SSTORE Question (Almost Always Comes Up)
When they ask about storage operations, here's your money answer:
SSTORE costs vary based on state changes:
20,000 gas for new storage slots (you're expanding global state)
5,000 gas for updating existing slots (slot already allocated)
200 gas for deleting values (you get a refund too!)
Pro tip: I usually mention that this pricing incentivizes developers to minimize state bloat - shows you understand the bigger picture.
The SLOAD Warm/Cold Access Pattern
This is where you can really shine. Most candidates miss the nuance here:
SLOAD normally costs 2,100 gas, but warm access is only 1 gas!
What I tell interviewers: "In production, I always batch storage reads and structure functions to take advantage of warm access patterns. It's the difference between a 50-cent transaction and a $5 one."
Slot Packing - The Practical Example
Here's where you show real-world expertise. Don't just explain it - give them code:
// ❌ Inefficient - uses 2 storage slots
uint128 balance;
uint128 rewards;
// ✅ Optimized - uses 1 storage slot
struct UserData {
uint128 balance;
uint128 rewards;
}
Key interview point: "This optimization can literally halve your storage costs because each slot is 32 bytes, and two uint128s fit perfectly in one slot."
Interview Red Flags to Avoid
Don't just memorize gas costs - explain the reasoning
Don't ignore practical implications (cost in real dollars)
Don't forget to mention refunds and EIP-2929 changes
Common Follow-Up Questions
Be ready for these:
"How would you optimize a contract with heavy storage usage?"
"What's the trade-off between memory and storage?"
"How do you handle dynamic arrays efficiently?"
My Secret Weapon Answer
When they ask about gas optimization, I always mention: "The best gas optimization is often architectural - sometimes it's better to use events for non-critical data or implement off-chain indexing rather than fighting with storage costs."
Shows you think beyond just code-level optimizations.
Hope this helps with your prep! The key is showing you understand both the technical details AND the business implications. Most candidates nail the first part but miss the second.
Good luck! 🚀
Drop a comment if you want me to cover any specific areas - always happy to help a fellow dev level up their interview game.