EIPs

EIP-1559 — Fee market change for ETH 1.0 chain

eips.ethereum.org/EIPS/eip-1559

The post-London fee market. Replaces a single gasPrice with maxFeePerGas + maxPriorityFeePerGas on a type-2 transaction, and adds a per-block baseFeePerGas that targets 50% block fullness via geometric adjustment. The type-2 tx wire format, the spec constants, and the base-fee arithmetic all live here.

import {
  transaction1559UnsignedSchema,
  transaction1559SignedSchema,
  encode_transaction_unsigned,
  calculate_base_fee,
  effective_gas_price,
  INITIAL_BASE_FEE,
  BASE_FEE_MAX_CHANGE_DENOMINATOR,
  ELASTICITY_MULTIPLIER,
} from "@ethernauta/eip/1559";

Surface

Wire format

ExportPurpose
transaction1559UnsignedSchema, Transaction1559UnsignedThe pre-signing payload: { chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gas, to, value, input, accessList }.
transaction1559SignedSchema, Transaction1559SignedThe signed envelope including v, r, s.
encode_transaction_unsignedRLP encode + 0x02 type prefix. The bytes you hash to produce the signing digest.

Spec constants

ExportValueSource
INITIAL_BASE_FEE1_000_000_000n (1 gwei)EIP-1559 §“Specification”
BASE_FEE_MAX_CHANGE_DENOMINATOR8nThe 12.5%-per-block cap.
ELASTICITY_MULTIPLIER2nTarget gas = gas limit / 2.

Arithmetic

ExportReturnsPurpose
calculate_base_feebigintNext block’s base fee from the parent block’s (gas_used, gas_limit, base_fee_per_gas). The spec formula, port for port.
effective_gas_pricebigintWhat a transaction actually pays: base_fee + min(max_priority_fee, max_fee - base_fee).

Where this used to live

Before the typed-transaction extraction, Transaction1559Unsigned and its codec lived in @ethernauta/eth/core/transaction/1559.ts. Spec arithmetic didn’t exist in the library at all. The move:

  • Eth now imports from @ethernauta/eip/1559 when its variant unions (signed.ts, unsigned.ts) need the type-2 schema.
  • eth_feeHistory and eth_maxPriorityFeePerGas stay in @ethernauta/eth — they’re execution-API methods, not EIP-paper-defined.
  • The dependency edge is now eth → eip, acyclic.

If you’re a consumer: pull Transaction1559Unsigned directly from @ethernauta/eip/1559. Don’t re-export through @ethernauta/eth.

When dapps need this

Most of the time you don’t construct the wire bytes yourself — @ethernauta/gas’s estimate_1559_fees composes the fee triple, and the wallet’s eth_sendTransaction handler does the encoding. You reach for these primitives when you need:

  • Path-2 signing. Sign + broadcast without a wallet: encode → hash → sign → eth_sendRawTransaction. See Concepts → two paths.
  • Block-by-block base-fee modeling. Predicting the next N blocks’ base fee via calculate_base_fee.
  • L2 fee surcharge composition. OP-stack’s getL1Fee(bytes) consumes a serialized type-2 unsigned transaction — that’s encode_transaction_unsigned.

See also