Skip to main content

Try it Live

Run Transaction examples in the interactive playground

Legacy Transactions

Original Ethereum transaction format with fixed gas price and EIP-155 replay protection.

Overview

Legacy transactions (Type 0) are the original transaction format used since Ethereum genesis. They use a fixed gasPrice and encode chain ID in the v signature component for replay protection (EIP-155).

Type Definition

Source: types.ts:59-72

Creating Legacy Transactions

EIP-155: Chain ID Encoding

EIP-155 adds replay protection by encoding chain ID in the v value.

v Value Calculation

Examples

getChainId

Extract chain ID from v value.

Returns

  • bigint - Chain ID if EIP-155 transaction
  • null - If pre-EIP-155 transaction (v = 27 or 28)

Usage

Implementation:
Source: Legacy/getChainId.js

Methods

All standard transaction methods work with legacy transactions:

RLP Encoding

Legacy transactions encode directly as RLP list (no type prefix):
Example:

Signing Hash

Legacy signing hash includes chain ID for EIP-155 transactions:

Gas Cost Calculation

Legacy transactions use simple gas cost:
Example:

Limitations

Legacy transactions have several limitations compared to newer types:
  1. No access lists - Cannot pre-declare storage access
  2. Fixed gas price - No dynamic fee market support
  3. Chain ID in signature - Wastes space compared to explicit field
  4. No blob support - Cannot attach L2 data
  5. No authorization lists - Cannot delegate to contracts

Migration to EIP-1559

Converting legacy to EIP-1559:

When to Use

Legacy transactions should be used:
  • When required by older infrastructure
  • On networks without EIP-1559 support
  • When interacting with wallets that only support legacy format
Prefer EIP-1559 for:
  • Modern Ethereum mainnet
  • Better gas price estimation
  • More predictable transaction costs
  • Access list optimization

EIP Reference