0Pricing
Web3 & DApp Development Fundamentals · Lesson

Gas Limits and Fees

EIP-1559 basics.

Gas Limits and Fees is a free Web3 & DApp Development Fundamentals lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Web3 & DApp Development Fundamentals learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Controlling What You Spend

You decide how much computation to allow and how much to pay. The two key controls are the gas limit and the fee parameters.

This lesson covers both, including the EIP-1559 fee model.

The Gas Limit

The gas limit is the maximum amount of gas you authorize a transaction to consume.

A simple ETH transfer needs 21000; complex contract calls need more. Setting it too low causes an out-of-gas revert.

simple transfer:  gasLimit = 21000
token transfer:   gasLimit ~ 65000
complex DeFi swap: gasLimit ~ 200000+

Out of Gas

If execution uses more gas than your limit, it stops and reverts all state changes.

Critically, you still pay for the gas already burned — running out of gas does not give you a refund.

Block Gas Limit

Each block also has a block gas limit — the total gas all its transactions may consume.

This caps how much computation fits in one block, keeping block processing fast across the network.

Before EIP-1559

Originally, fees worked as a blind auction: you bid a gas price and validators picked the highest bids.

This led to overpaying and unpredictable fees during congestion. EIP-1559 reformed this in 2021.

EIP-1559: Base Fee

EIP-1559 introduced a base fee — a per-block fee set automatically by the protocol based on network demand.

The base fee rises when blocks are full and falls when they are empty, making fees more predictable.

block full   -> base fee rises
block empty  -> base fee falls
target: blocks ~50% full

The Burned Base Fee

The base fee is burned — permanently destroyed rather than paid to validators.

This removes the incentive for validators to artificially inflate fees and makes ETH mildly deflationary under heavy use.

Priority Fee (Tip)

To incentivize validators, you add a priority fee, or tip, on top of the base fee.

A higher tip encourages validators to include your transaction sooner during congestion.

totalFee = base fee + priority fee
base fee  -> burned
priority fee (tip) -> validator

Max Fee per Gas

You set a maxFeePerGas — the most you will pay per gas unit total. You also set a maxPriorityFeePerGas for the tip.

If the base fee is below your max, you are refunded the difference. You never overpay beyond your cap.

maxFeePerGas          = 50 gwei
maxPriorityFeePerGas  = 2 gwei
actual base fee       = 30 gwei
paid = 30 + 2 = 32 gwei (refunded 18)

Estimating Gas

Wallets and tools call eth_estimateGas to predict how much gas a transaction needs.

Good estimates avoid out-of-gas failures while not over-reserving gas unnecessarily.

Putting It Together

The gas limit caps computation; EIP-1559 splits the price into a burned base fee plus a validator tip.

Your maxFeePerGas guards against overpaying while ensuring inclusion.

Quick Check

Test your EIP-1559 knowledge.

Recap: Gas Limits and Fees

You learned that:

  • The gas limit caps how much gas a transaction may use
  • Running out of gas reverts but still costs you
  • EIP-1559 uses a burned base fee plus a validator tip
  • maxFeePerGas caps your total cost per unit

Next: nonces and ordering.

Frequently asked questions

Is the “Gas Limits and Fees” lesson free?

Yes — the full text of “Gas Limits and Fees” is free to read here on the web, and the Web3 & DApp Development Fundamentals course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Web3 & DApp Development Fundamentals course, upgrade to CoddyKit PRO.

What will I learn in “Gas Limits and Fees”?

EIP-1559 basics. You practise Web3 & DApp Development Fundamentals with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Web3 & DApp Development Fundamentals?

No prior experience is required. Web3 & DApp Development Fundamentals on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Gas Limits and Fees” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Web3 & DApp Development Fundamentals lesson?

Yes. Every Web3 & DApp Development Fundamentals lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. What Is Gas
  2. Transaction Lifecycle
  3. Gas Limits and Fees
  4. Nonces and Ordering
← Back to Web3 & DApp Development Fundamentals