EIP 1559

Resources

Motivation

Move away from auction to address extreme volatility in gas prices (among other compelling motivations).

Variables

burned:   tx.baseFeePerGas * gasUsed
miner:    tx.maxPriorityFeePerGas * gasUsed
returned: tx.maxFeePerGas * gasUsed
    - (tx.baseFeePerGas + tx.maxPriorityFeePerGas) * gasUsed

baseFeePerGas Calculation

gas_used = prev_block.gas_used
gas_target = prev_block.gas_limit / 2
base_fee = prev_block.base_fee_per_gas

def calc_base_fee(gas_used, gas_target, base_fee):
  first block?
      return 1000000000
  gas_used == gas_target
      return gas_target
  gas_used > gas_target
      delta = gas_used - gas_target
      return base_fee + (base_fee * delta / gas_target / 8)
  gas_used < gas_target
      delta = gas_target - gas_used
      return base_fee + (base_fee * delta / gas_target / 8)

Summary,

Transaction Ordering

It is recommended that transactions with the same priority fee be sorted by time the transaction was received to protect the network from spamming attacks where the attacker throws a bunch of transactions into the pending pool in order to ensure that at least one lands in a favorable position. Miners should still prefer higher gas premium transactions over those with a lower gas premium, purely from a selfish mining perspective.

Questions