Try it Live
Run RLP examples in the interactive playground
Type Definition
Branded data structure for RLP-encoded data with type-safe encoding and decoding.Quick Reference
API Methods
Constructors
- from - Create RLP data structures from bytes or nested arrays
Encoding
- encode - Encode bytes, lists, and nested structures
- encodeBytes - Encode raw bytes to RLP format
- encodeList - Encode array of items to RLP list
- encodeArray - Encode array with variadic arguments
- encodeObject - Encode object to RLP structure
- encodeVariadic - Encode multiple arguments
- encodeBatch - Batch encode multiple items
Decoding
- decode - Decode RLP bytes to data structures
- decodeArray - Decode RLP list to array
- decodeObject - Decode RLP to object
- decodeBatch - Batch decode multiple RLP items
Validation
- validate - Validate RLP encoding structure and format
Utilities
- getEncodedLength - Calculate encoded length without encoding
- getLength - Get length of RLP item
- flatten - Flatten nested RLP structure
- equals - Compare RLP data equality
- toRaw - Convert to raw array
Type Guards
- isData - Check if value is RLP data
- isBytesData - Check if value is bytes data
- isListData - Check if value is list data
- isList - Check if value is RLP list
- isString - Check if value is RLP string
Serialization
Types
- BrandedRlp
- Encodable
- Decoded
Related
- Fundamentals - Learn RLP encoding and decoding
- Transaction - Uses RLP for serialization
- Keccak256 - Keccak256 hashing for RLP data
- Hex - Hex string encoding
Specification
- Ethereum Yellow Paper - Formal RLP specification (Appendix B)
- Ethereum Wiki - RLP - RLP encoding guide
- EIP-2718 - Typed transaction envelope using RLP

