Julian's Notes

EIP 1559

Resources

Motivation

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

Variables

  • baseFeePerGas: Comes from protocol via the previous block's header. Mandatory to pay this. This part of the fee gets burned (gasUsed * baseFeePerGas).
  • maxPriorityFeePerGas: User sets; additional fee that goes directly to miner to prioritize the transaction.
  • maxFeePerGas: User sets; the max amount a user is willing to pay for the tx (combines baseFeePerGas and maxPriorityFeePerGas)
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,

  • If used 50% of previous block gas limit, don't change next block base fee
  • Otherwise, bring the base fee up or down relative to match 50% of previous block gas limit (max movement is 12.5%)

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

  • Why doesn't the priority fee revert back into a blind auction?

Referred in

EIP 1559