Sub topic 9
What Network Fees Pay For
Prerequisites and the basic idea
This chapter assumes you understand what a blockchain transaction is, can read a fee estimate in a wallet, and know that 1 bitcoin or ether can be divided into smaller units. A network fee is the amount paid to get a transaction processed and recorded by a blockchain.
Blockchains have limited capacity. A block can include only a limited amount of transaction data or computation. When many users want confirmation at the same time, they compete for this scarce block space. The fee is the transaction’s bid for inclusion.
The fee usually compensates the people or organizations that operate the network:
- Bitcoin miners use computing power and electricity to produce blocks.
- Proof-of-stake validators provide capital and infrastructure to propose or attest to blocks.
- Some networks burn part of a fee instead of paying it to a validator.
- The exact split depends on the blockchain’s rules.
A fee does not buy a guaranteed confirmation time. It increases the chance that a block producer selects your transaction soon.
What happens to a network fee?
A simplified transaction path looks like this:
The mempool is the temporary waiting area for valid but unconfirmed transactions. Block producers generally prefer transactions with higher fees relative to the resources they consume.
A transaction can remain pending if its fee is too low for current demand. It can also become unprocessable if its fee is set incorrectly or if the transaction expires under that network’s rules.
Bitcoin and EVM networks use different measurements
Bitcoin fees are normally quoted in satoshis per virtual byte, or sat/vB. The total fee is approximately:
| Network model | Main resource | Basic fee calculation |
|---|---|---|
| Bitcoin | Transaction size | virtual size × satoshis per vB |
| EVM chain | Computation and data | gas used × effective gas price |
On an EVM chain, gas is a unit that measures computational work and data use. A simple transfer uses less gas than a smart-contract swap. The sender usually sets a gas limit, which is the maximum gas the transaction may consume. The final fee normally depends on gas actually used, not the unused part of the limit.
On Ethereum, the effective gas price combines a base fee and a priority fee. The base fee is burned, while the priority fee, sometimes called the tip, goes to the validator. Other EVM networks may distribute these parts differently.
GWEI = 10**9
WEI_PER_ETH = 10**18
def evm_fee_eth(gas_used, base_fee_gwei, priority_fee_gwei):
effective_price = base_fee_gwei + priority_fee_gwei
return gas_used * effective_price * GWEI / WEI_PER_ETH
print(evm_fee_eth(21_000, 20, 2)) # 0.000462 ETHA failed smart-contract transaction can still consume gas. The network performed the requested computation even though the contract execution did not produce the desired result.
Exercise
Why can a failed EVM transaction still charge a fee?
Show answer
The network consumed computation and block space while executing and recording the transaction, so the used gas must still be paid.