Try it Live
Run Transaction examples in the interactive playground
format
Format transaction for human-readable display.Format Components
The formatted output includes:- Transaction Type - Legacy, EIP-2930, EIP-1559, EIP-4844, or EIP-7702
- Operation - Transfer or contract creation
- Recipient - Address (shortened) or “contract creation”
- Value - ETH amount if non-zero
- Nonce - Transaction sequence number
- Data - Byte length if present
Format Patterns
Standard Transfer
"EIP-1559 tx to 0x742d35Cc..., value: 1 ETH, nonce: 5"
Contract Creation
"EIP-1559 contract creation, data: 1234 bytes, nonce: 0"
Zero Value Transfer
"Legacy tx to 0x..., nonce: 10"
With Data
"EIP-1559 tx to 0x..., value: 0.1 ETH, data: 68 bytes, nonce: 2"
Usage Patterns
Logging
User Notifications
Debug Output
Transaction History
Error Messages
Batch Processing
Custom Formatting
For more control, access fields directly:Comparison with toString
UnlikeJSON.stringify, format() provides human-readable output:
See Also
- hash - Transaction hash computation
- getSender - Recover sender address
- getChainId - Extract chain ID
- getGasPrice - Get effective gas price
References
- EIP-2718: Typed Transaction Envelope
- Transaction Types - Complete type definitions

