Límites y comisiones de gas
Fundamentos de EIP-1559
Límites y comisiones de gas es una lección gratuita de Web3 & DApp Development Fundamentals en CoddyKit. Esta es la lección 3 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de Web3 & DApp Development Fundamentals, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de Web3 & DApp Development Fundamentals incluye 4 lecciones en total.
Partes de esta lección aún no han sido traducidas y se muestran en inglés.
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% fullThe 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) -> validatorMax 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.
Preguntas frecuentes
¿La lección «Límites y comisiones de gas» es gratis?
Sí — el texto completo de «Límites y comisiones de gas» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de Web3 & DApp Development Fundamentals, actualiza a CoddyKit PRO. El curso de Web3 & DApp Development Fundamentals incluye 4 lecciones en total.
¿Qué aprenderé en «Límites y comisiones de gas»?
Fundamentos de EIP-1559 Practicas Web3 & DApp Development Fundamentals con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.
¿Necesito experiencia previa para empezar Web3 & DApp Development Fundamentals?
No se requiere experiencia previa. Web3 & DApp Development Fundamentals en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 3 de 4.
¿Cuánto tiempo toma la lección «Límites y comisiones de gas»?
La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.
¿Puedo escribir y ejecutar código en esta lección de Web3 & DApp Development Fundamentals?
Sí. Cada lección de Web3 & DApp Development Fundamentals incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.
Todas las lecciones de este curso
- Qué es el gas
- Ciclo de vida de una transacción
- Límites y comisiones de gas
- Nonces y ordenación