Advanced Solidity Understanding and Optimizing Gas Costs

Mastering the Ethereum Virtual Machine and the Solidity Compiler
Advanced Solidity Understanding and Optimizing Gas Costs
File Size :
1.19 GB
Total length :
2h 48m



Jeffrey Scholz


Last update




Advanced Solidity Understanding and Optimizing Gas Costs

What you’ll learn

Learn how the Ethereum Virtual Machine sets the gas price
Learn how to improve the gas price of existing code
Learn how to debug execution costs for smart contracts
Learn what designs to avoid that lead to high execution costs

Advanced Solidity Understanding and Optimizing Gas Costs


Basic understanding of solidity
Ideally, created an ERC-20 or ERC-721 token before


Ever been surprised by the gas costs in a smart contract? The Ethereum Virtual Machine calculates these costs deterministically, but understanding how is a bit obscure unless you want to comb through the dense yellowpaper! This course helps you understand where every last bit of gas is coming from and the gotchas that can make transactions surprisingly expensive.This course is for solidity developers looking to progress from beginner to advanced intermediate. Knowledge about Solidity, OpenZeppelin, and Remix is assumed. You should know how to deploy and test a smart contract, and ideally, you’ve created a token on the mainnet before (and experienced how expensive it can be!).I’m the author of ERC1155D, arguably the most efficient NFT contract created. I’m here to share my learnings with you!Some of the most enjoyable years of my life was teaching computer science at Columbia University, so I’m happy to relive those years virtually!Topics covered include:A deep dive into the solidity compilerA deep dive into the Ethereum Virtual MachineHow to understand the output from the solidity compilerHow to track down wasteful computationUnderstanding gas cost specificationsTechniques for improving gas costsHow memory, transaction data, state changes, and computational cost affect transaction costBad designs to avoidWhere the Yellowpaper is wrong!Follow me on Twitter: @jeyffre


Section 1: Part 1: Overview of Gas Cost

Lecture 1 Introduction

Lecture 2 Lecture 2: Calculating The Cost of an Ethereum Transfer

Lecture 3 Example Smart Contract Interactions Part 1

Lecture 4 Example Smart Contract Interactions Part 2

Lecture 5 Example Smart Contract Interactions Part 2

Lecture 6 Heavy and Light Functions

Lecture 7 Block Limit

Lecture 8 Gas Efficient Chains

Lecture 9 Prerequisite: Storage Slots

Lecture 10 What are Opcodes

Lecture 11 Opcode Gas Cost

Lecture 12 Opcode Debugging Gas Cost

Lecture 13 Function Selectors

Lecture 14 Cost of Doing Nothing: Op Codes

Lecture 15 Cost of Doing Nothing: Sum of Op Codes

Lecture 16 Cost of Doing Nothing: Transaction Data

Lecture 17 Cost of Doing Nothing: Memory Costs

Lecture 18 Non-payable Functions

Lecture 19 Unchecked Arithmetic Part 1

Lecture 20 Unchecked Arithmetic Part 2

Lecture 21 Gas Limit and More on 21,000 Gas

Lecture 22 EIP 1559 Part 1

Lecture 23 EIP 1559 Part 2

Lecture 24 Solidity Optimizer

Section 2: Part 2: Storage

Lecture 25 Storage Overview

Lecture 26 More on 5000 gas non-zero to non-zero

Lecture 27 Smaller Integers

Lecture 28 Unchanged Storage Values

Lecture 29 Arrays

Lecture 30 Refunds and Setting to Zero Part 1

Lecture 31 Refunds and Setting to Zero Part 2

Lecture 32 ERC20 Transfers

Lecture 33 Storage Cost For Files

Lecture 34 Structs and Strings Part 1

Lecture 35 Variable Packing

Lecture 36 Array Length

Section 3: Part 3: Memory Costs

Lecture 37 Memory vs Calldata

Lecture 38 Memory Explosion

Lecture 39 Memory is Never Cleared

Section 4: Solidity Tricks

Lecture 40 Function Names

Lecture 41 Less Than vs Less Than or Equal To

Lecture 42 Bit Shifting

Lecture 43 Reverting Early

Lecture 44 Short Circuiting

Lecture 45 Precomputing

Section 5: Practice Problems

Lecture 46 Gas Puzzles

Smart contract developers looking to make their smart contracts more gas efficient

Course Information:

Udemy | English | 2h 48m | 1.19 GB
Created by: Jeffrey Scholz

You Can See More Courses in the Business >> Greetings from

New Courses

Scroll to Top