What changed
Before EIP-1559, transactions specified a singlegasPrice field. Miners prioritized transactions with higher gasPrice bids. This model made gas estimation unpredictable during periods of high demand.
EIP-1559 introduced a new transaction type, Type 2, which splits the old gasPrice into two components:
baseFee: a network-determined fee that is burned, calculated based on how full the previous block was. All transactions must pay this fee.priorityFee(tip): an optional amount offered to the validator to prioritize the transaction.
maxFeePerGas sets the ceiling on what you are willing to pay. The actual fee paid is baseFee + priorityFee, where priorityFee = min(maxPriorityFeePerGas, maxFeePerGas - baseFee).
Legacy Type 0 transactions remain compatible but the Type 2 format is recommended.
Legacy transaction (Type 0)
In a legacy transaction, onlygasPrice is specified:
Type 2 transaction (EIP-1559)
Type 2 transactions usemaxPriorityFeePerGas instead of gasPrice. The baseFee is paid regardless, so only the tip is bid:
Gas estimation
The Polygon Gas Station V2 provides current gas fee estimates:See also
- How to send transactions with EIP-1559 - covers both the legacy and EIP-1559 approaches.
- Send an EIP-1559 transaction with ethers.js - quicknode guide.