0Pricing
Web3 & DApp Development Fundamentals · Lektion

Was ist Gas?

Berechnung bezahlen

Was ist Gas? ist eine kostenlose Web3 & DApp Development Fundamentals-Lektion auf CoddyKit. Dies ist Lektion 1 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Web3 & DApp Development Fundamentals-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Web3 & DApp Development Fundamentals-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

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.

Häufig gestellte Fragen

Ist die Lektion „Was ist Gas?“ kostenlos?

Ja — der vollständige Text von „Was ist Gas?“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Web3 & DApp Development Fundamentals-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Web3 & DApp Development Fundamentals-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Was ist Gas?“?

Berechnung bezahlen Du übst Web3 & DApp Development Fundamentals mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um Web3 & DApp Development Fundamentals zu starten?

Keine Vorkenntnisse erforderlich. Web3 & DApp Development Fundamentals auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 1 von 4.

Wie lange dauert die Lektion „Was ist Gas?“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser Web3 & DApp Development Fundamentals-Lektion Code schreiben und ausführen?

Ja. Jede Web3 & DApp Development Fundamentals-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Was ist Gas?
  2. Transaktionslebenszyklus
  3. Gas-Limits und Gebühren
  4. Nonces und Reihenfolge
← Zurück zu Web3 & DApp Development Fundamentals