EIPs
EIP-1559 — Fee market change for ETH 1.0 chain
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
| Export | Purpose |
|---|---|
transaction1559UnsignedSchema, Transaction1559Unsigned | The pre-signing payload: { chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gas, to, value, input, accessList }. |
transaction1559SignedSchema, Transaction1559Signed | The signed envelope including v, r, s. |
encode_transaction_unsigned | RLP encode + 0x02 type prefix. The bytes you hash to produce the signing digest. |
Spec constants
| Export | Value | Source |
|---|---|---|
INITIAL_BASE_FEE | 1_000_000_000n (1 gwei) | EIP-1559 §“Specification” |
BASE_FEE_MAX_CHANGE_DENOMINATOR | 8n | The 12.5%-per-block cap. |
ELASTICITY_MULTIPLIER | 2n | Target gas = gas limit / 2. |
Arithmetic
| Export | Returns | Purpose |
|---|---|---|
calculate_base_fee | bigint | Next 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_price | bigint | What 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/1559when its variant unions (signed.ts,unsigned.ts) need the type-2 schema. eth_feeHistoryandeth_maxPriorityFeePerGasstay 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’sencode_transaction_unsigned.
See also
- @ethernauta/gas — the fee-estimation layer built on these primitives.
- EIP-2930 — the access list schema 1559 consumes.
- EIP-4844 — blob transactions extend the 1559 fee market.
- Concepts → folder-shaped standards.