Try it Live
Run Transaction examples in the interactive playground
detectType
Detect transaction type from serialized bytes.Type Detection Logic
Typed Transactions (EIP-2718)
Typed transactions start with a type byte (0x00-0x04):| First Byte | Type |
|---|---|
0x01 | EIP-2930 (Access List) |
0x02 | EIP-1559 (Dynamic Fee) |
0x03 | EIP-4844 (Blob) |
0x04 | EIP-7702 (Authorization) |
0xc0-0xff | Legacy (RLP list marker) |
Legacy Transactions
Legacy transactions start with RLP list marker (0xc0-0xff):0xc0-0xf7: Short list (0-55 bytes)0xf8-0xff: Long list (>55 bytes)
Usage Patterns
Router Pattern
Conditional Deserialization
Transaction Classification
Block Analysis
Network Statistics
Pre-validation
Efficient Filtering
Error Handling
Type Guard Pattern
See Also
- serialize - Serialize transactions to bytes
- deserialize - Deserialize bytes to transactions
- Transaction Types - Complete type definitions
- format - Format transaction for display
References
- EIP-2718: Typed Transaction Envelope
- RLP Encoding
- Transaction Types - Overview of all transaction types

