Ethereum charges for computation in gas units, then prices those units separately in the network's currency. The split looks like an extra step and is in fact what makes the fee system work.
Gas measures work, not money
Every operation the virtual machine can perform carries a fixed gas cost, set according to how much computation, memory and storage it consumes.
A transaction's gas usage is therefore a property of what it does, and it is identical whether the currency is expensive or cheap that day.
This keeps the relative cost of operations stable. Writing to storage should always cost far more than adding two numbers, regardless of market conditions.
The price per unit is where the market operates
Block space is limited, so users bid for inclusion by offering a price per gas unit, and producers order transactions by what they will earn.
Congestion raises the price without changing any operation's gas cost, so the fee for the same transaction varies over time while its measured work does not.
Separating the two also means the protocol can reprice an operation through an upgrade, if it proves cheaper or more expensive to execute than originally assumed, without touching the fee market.
Limits protect nodes from unbounded work
Each transaction specifies a maximum amount of gas it may consume, which is the sender's protection against a contract that loops indefinitely.
If execution exhausts that allowance, it halts and the state changes are reverted, but the gas consumed is still paid because the work was genuinely performed.
Blocks carry their own ceiling, which is what bounds how long validation can take and therefore keeps node requirements manageable.
The base fee responds to demand automatically
The protocol computes a base fee per block from how full the previous block was, raising it when blocks exceed the target size and lowering it when they fall below.
Users add a priority tip on top to compete for position within a block, so the total offered has a predictable component and a competitive one.
Because the base fee adjusts smoothly rather than through open bidding, wallets can estimate costs with reasonable confidence a few blocks ahead.
The abstraction survives changes underneath
New operations added by upgrades are priced in the same units, so tooling that reasons about gas continues to work.
Layer two networks reuse the model, charging their own gas for execution and passing through the cost of settling data on the base chain.
This is why fee estimates on rollups have two components, and why their cheapness depends on conditions on a chain the user is not directly transacting on.