Skip to main content

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):

    Legacy Transactions

    Legacy transactions start with RLP list marker (0xc0-0xff):
    RLP list markers:
    • 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

    References