Gas上限と手数料
EIP-1559の基礎
「Gas上限と手数料」はCoddyKit上の無料Web3 & DApp Development Fundamentalsレッスンです。 これはレッスン3/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはWeb3 & DApp Development Fundamentals学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Web3 & DApp Development Fundamentalsコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
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.
よくある質問
「Gas上限と手数料」レッスンは無料ですか?
はい。「Gas上限と手数料」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Web3 & DApp Development Fundamentalsコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Web3 & DApp Development Fundamentalsコースには全4レッスンが含まれています。
「Gas上限と手数料」で何を学びますか?
EIP-1559の基礎 ブラウザで直接実行するハンズオンコードでWeb3 & DApp Development Fundamentalsを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Web3 & DApp Development Fundamentalsを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのWeb3 & DApp Development Fundamentalsは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン3/4です。
「Gas上限と手数料」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このWeb3 & DApp Development Fundamentalsレッスンでコードを書いて実行できますか?
はい。すべてのWeb3 & DApp Development Fundamentalsレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- Gasとは
- トランザクションのライフサイクル
- Gas上限と手数料
- Nonceと順序付け