Install & Compatibility
Where this runs
tested against v3.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.720s · 40.3MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.9s · import 0.662s · 42MB
40MB installed
● package 40MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
HashableRLP
✓ from eth_rlp import HashableRLP
✗ from ethereum_rlp import encode
main
✓ from eth_rlp import main
✗ from ethereum_rlp import encode
This example demonstrates defining an RLP schema using a dataclass, then encoding a Python object into RLP bytes and decoding it back. It utilizes `ethereum_types.numeric.Uint` for integer types.
from dataclasses import dataclass
from ethereum_rlp import encode, decode_to
from ethereum_types.numeric import Uint
from typing import List
@dataclass
class Stuff:
toggle: bool
number: Uint
sequence: List["Stuff"]
# Encode an object
original_stuff = Stuff(toggle=True, number=Uint(3), sequence=[])
encoded_data = encode(original_stuff)
print(f"Encoded: {encoded_data.hex()}")
# Decode back to the object type
decoded_stuff = decode_to(Stuff, encoded_data)
print(f"Decoded number: {decoded_stuff.number}")
assert decoded_stuff.number == Uint(3)
Debug
Known issues
breakingEthereum's EIP-7934 introduced a strict upper limit on the size of RLP-encoded execution blocks (10 MiB plus a safety margin). Applications using `eth-rlp` to create large transactions or data structures must ensure they adhere to these new size constraints, as oversized blocks are non-backward compatible and will be rejected by the network.fixReview transaction and data payloads to ensure they do not exceed the `MAX_RLP_BLOCK_SIZE` (approximately 12 MiB total) imposed by EIP-7934. Split larger operations if necessary.
affects: Ethereum protocol versions after EIP-7934 activation.
gotchaRLP is designed specifically for encoding arbitrarily nested arrays of binary data. It does not inherently handle all Python data types (e.g., floats, complex objects beyond basic lists/bytes/integers) directly. Higher-order protocols or libraries (like `eth-rlp` using dataclasses) are required to map complex Python objects to RLP-compatible structures. Positive integers must be represented in big-endian binary form with no leading zeros.fixAlways convert Python data to RLP-compatible types (bytes, lists of bytes/lists, big-endian integers without leading zeros) before encoding. Utilize schema definitions (e.g., dataclasses with `eth-rlp`) to manage complex object serialization correctly.
affects: All versions
gotchaEthereum's execution layer predominantly uses RLP for serialization, while the newer consensus layer (Beacon Chain) has transitioned to Simple Serialize (SSZ). Developers interacting with both layers must be aware of these distinct serialization standards, as they are not interchangeable and can introduce complexity when building unified clients or applications.fixBe mindful of which Ethereum layer data is being processed for and use the appropriate serialization library (RLP for execution, SSZ for consensus) to avoid compatibility issues.
affects: All versions (Ethereum 2.0 and later)
gotchaThe RLP encoding structure for EIP-1559 transactions has been refined (e.g., to avoid an 'extra empty byte' for legacy gas price fields). Applications relying on a precise RLP byte-level representation of EIP-1559 transactions, especially older implementations, might encounter discrepancies with current specifications if not updated.fixEnsure `eth-rlp` is up-to-date and that custom parsing or construction of RLP-encoded EIP-1559 transactions aligns with the latest Ethereum protocol specifications for transaction envelopes.
affects: Potentially older versions prior to RLP encoding updates for EIP-1559.
Upgrade
Version history
3.0.0latest on PyPI · released Aug 22, 2026
Audit
Dependencies
ethereum-typesrequiredRequired for core Ethereum numeric types like Uint used in RLP schemas.