0Pricing
Web3 & DApp Development Fundamentals · レッスン

Gasとは

計算の対価を支払います

「Gasとは」はCoddyKit上の無料Web3 & DApp Development Fundamentalsレッスンです。 これはレッスン1/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはWeb3 & DApp Development Fundamentals学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Web3 & DApp Development Fundamentalsコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Why Computation Costs Money

Every operation on Ethereum runs on thousands of nodes worldwide. To prevent abuse and pay for this work, the network charges gas.

Gas is the unit that measures computational effort.

What Is Gas?

Gas is a unit of measurement for the work required to execute operations on the EVM.

Sending ETH, calling a contract, or storing data each consume a specific amount of gas based on their complexity.

Gas Units per Operation

Different operations cost different amounts of gas. Simple operations are cheap; storage is expensive.

ADD        ->     3 gas
MUL        ->     5 gas
SLOAD      ->  2100 gas (read storage)
SSTORE     -> 20000 gas (new storage)
base tx    -> 21000 gas

Gas vs Gas Price

Keep two ideas separate:

  • Gas used — how much computation the transaction needs (units)
  • Gas price — how much you pay per unit, measured in gwei

Total fee = gas used multiplied by gas price.

Gwei: The Fee Unit

Gas prices are quoted in gwei, a tiny fraction of ETH. One gwei equals one billionth of an ETH (10^-9).

Quoting in gwei keeps numbers readable instead of writing many leading zeros.

1 ETH   = 1,000,000,000 gwei
1 gwei  = 1,000,000,000 wei
1 wei   = smallest unit of ETH

Calculating a Fee

The transaction fee is straightforward arithmetic. Multiply the gas your transaction consumes by the price you pay per unit of gas.

gasUsed   = 21000
gasPrice  = 20 gwei
fee = 21000 * 20 = 420000 gwei
    = 0.00042 ETH

Why Gas Exists

Gas serves two purposes:

  • Spam prevention — attackers cannot flood the network for free
  • Resource pricing — heavy computation costs more, encouraging efficient code

The Halting Problem Solution

Gas also stops infinite loops. Each step consumes gas, and when a transaction runs out, execution halts.

This guarantees the EVM always terminates — you cannot freeze the network with a runaway loop.

while (true) {
    // each iteration burns gas
}
// eventually: OUT OF GAS -> reverts

Who Receives the Fee?

Gas fees compensate the validators who include and execute your transaction.

Under EIP-1559, part of the fee is actually burned (destroyed), and a smaller tip goes to the validator. We cover this in a later lesson.

Gas and Smart Contracts

Complex smart contract calls cost more gas than simple transfers because they execute many operations.

Efficient contract code directly lowers user costs — gas optimization is a core skill for Solidity developers.

Putting It Together

Gas measures computational work; gas price (in gwei) sets the cost per unit. Their product is your fee.

Gas prevents spam, prices resources fairly, and guarantees execution always terminates.

Quick Check

Test your understanding of gas.

Recap: What Is Gas

You learned that:

  • Gas measures computational work on the EVM
  • Gas price is paid per unit in gwei
  • Fee = gas used multiplied by gas price
  • Gas prevents spam and stops infinite loops

Next: the full lifecycle of a transaction.

よくある質問

「Gasとは」レッスンは無料ですか?

はい。「Gasとは」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Web3 & DApp Development Fundamentalsコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Web3 & DApp Development Fundamentalsコースには全4レッスンが含まれています。

「Gasとは」で何を学びますか?

計算の対価を支払います ブラウザで直接実行するハンズオンコードでWeb3 & DApp Development Fundamentalsを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Web3 & DApp Development Fundamentalsを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのWeb3 & DApp Development Fundamentalsは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン1/4です。

「Gasとは」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このWeb3 & DApp Development Fundamentalsレッスンでコードを書いて実行できますか?

はい。すべてのWeb3 & DApp Development Fundamentalsレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. Gasとは
  2. トランザクションのライフサイクル
  3. Gas上限と手数料
  4. Nonceと順序付け
← Web3 & DApp Development Fundamentalsに戻る