How are transaction fees calculated on Ethereum today?
What the interviewer wants to hear
- Fee = gas used times the price per gas
- Base fee set by the protocol and burned; it rises and falls with demand
- Priority fee (tip) goes to the validator
- Users set max fee and max priority fee; unused amount is not charged
- L2s charge a small execution fee plus a share of L1 data cost
Model answer
Every operation in the EVM costs a fixed amount of gas, and the fee is the gas used multiplied by the price per gas. Since EIP-1559, the price has two parts. The base fee is set by the protocol for each block, goes up when blocks are more than half full and down when they are emptier, and it is burned. The priority fee, or tip, goes to the validator and helps you get included faster. In a transaction you set a gas limit, a max fee per gas and a max priority fee; you pay base fee plus tip, never more than the max, and you only pay for gas actually used. On Layer 2s fees are much lower: you pay for L2 execution plus your share of the cost of posting data to Ethereum, which is cheap now that rollups use blobs.
Can you answer it under time pressure?
Take a timed easy round and get scored on every answer.
More easy Blockchain Developer questions
- Explain what a blockchain is to someone who is not technical.
- What is a smart contract, and what are its main limitations?
- What is the ERC-20 standard and what are its key functions and events?
- What is the difference between proof of work and proof of stake?
- Describe the basic architecture of a decentralised application (dApp).
- How does a crypto wallet work, and what is the role of the private key and the seed phrase?
- Compare ERC-20, ERC-721 and ERC-1155. When would you use each?
- What are Layer 2 networks, and why are they important for Ethereum?
- What are events in Solidity, and how do you use them in a real project?