Try it Live
Run Transaction examples in the interactive playground
Transaction
Complete Ethereum transaction implementation supporting all transaction types from Legacy to EIP-7702.Overview
Transaction module provides type-safe encoding, decoding, signing, and hashing for all Ethereum transaction types. Supports Legacy (Type 0), EIP-2930 (Type 1), EIP-1559 (Type 2), EIP-4844 (Type 3), and EIP-7702 (Type 4) transactions with full RLP serialization.Quick Start
- Basic Usage
- Type-Specific Operations
- Utilities
Effect Schema
Quick Reference
Core Operations
| Method | Description |
|---|---|
serialize(tx) | RLP encode to bytes |
deserialize(data) | RLP decode from bytes |
detectType(data) | Detect type from serialized bytes |
hash(tx) | Compute transaction hash |
getSigningHash(tx) | Get hash to sign |
Signature Operations
| Method | Description |
|---|---|
getSender(tx) | Recover sender address |
verifySignature(tx) | Validate signature |
isSigned(tx) | Check if signed |
assertSigned(tx) | Assert signed (throws) |
RPC Conversion
| Method | Description |
|---|---|
toRpc(tx) | Convert to JSON-RPC format |
fromRpc(rpc) | Parse from JSON-RPC format |
Utilities
| Method | Description |
|---|---|
getChainId(tx) | Extract chain ID |
getGasPrice(tx, baseFee?) | Get effective gas price |
hasAccessList(tx) | Check for access list |
getAccessList(tx) | Get access list |
format(tx) | Format for display |
Transaction Types
Type Definitions
API Methods
Serialization
- serialize - RLP encode transaction to bytes
- deserialize - RLP decode transaction from bytes
- detectType - Detect transaction type from serialized bytes
- toRpc - Convert transaction to JSON-RPC format
- fromRpc - Parse transaction from JSON-RPC format
Hashing
- hash - Compute transaction hash
- getSigningHash - Get hash to sign
Signatures
- getSender - Recover sender address from signature
- verifySignature - Validate transaction signature
- isSigned - Check if transaction is signed
- assertSigned - Assert transaction is signed (throws if not)
Gas Pricing
- getGasPrice - Calculate effective gas price
- getEffectiveGasPrice - Get effective gas price for EIP-1559
- getBlobGasCost - Calculate blob gas cost for EIP-4844
Access Lists
- hasAccessList - Check if transaction has access list
- getAccessList - Retrieve access list data
Utilities
- getChainId - Extract chain ID from transaction
- format - Format transaction for display
Usage Patterns
Common patterns for working with transactions: View usage patterns →Tree-Shaking
Import only what you need:Related
- Address - 20-byte Ethereum addresses
- Keccak256 - 32-byte hash values
- Hex - Hex string utilities
- RLP - Recursive Length Prefix encoding
- AccessList - Pre-declared account/storage access
- Blob - Blob data for EIP-4844
- Authorization - EOA delegation for EIP-7702
- FeeMarket - Base fee and priority fee calculations
- GasConstants - Gas intrinsic costs
- Secp256k1 - ECDSA signature utilities

