Skip to main content

MessagePack with Ethereum RLP encoding for Python

This library uses a modified version of msgpack to encode and decode binary data according to the Ethereum RLP specification here https://github.com/ethereum/wiki/wiki/RLP

This is the first release of this library, and there are likely still bugs. Use at your own risk.

Install

$ pip install msgpack-rlp-python

USAGE

RLP doesn’t specify the variable type, so all encoded data is decoded to a bytestring representation. In order to specify the variable types, we use sedes. Sedes are ways of telling the program what variable types you expect from the encoded data. In this version there are only 2 supported sedes: bytes (represented by the integer 0) and integers (represented by the integer 1). These sedes can also contained within lists or nested lists. In order to show that the sedes live within lists or nested lists, we use the standard python list notation. See below.

  • All lists will be decoded to tuples by default. To decode to a list set use_list = True

  • Sedes are only used when decoding. This library is smart enough to know what variable types are being encoded, and will convert them to the RLP spec correctly.

  • This is meant to be a stand-in replacement of msgpack. So the package to import is still called msgpack.

Example sedes:

var = b'\x01'
sede = 0 # A bytestring

var = 12381239
sede = 1 # An integer

var = [b'\x01', b'\x02', b'\x03', b'\x04']
sede = [0] # A list of bytestrings

var = [12312,1234,213412,213421]
sede = [1] # A list of integers

var = [b'\x01', [12312,1234]]
sede = [0,[1]] # Different types, and nested lists

Example usage without sedes. This will always decode to bytestrings.

>>> import msgpack
>>> msgpack.packb([1, 2, 3])
'b'\xc3\x01\x02\x03''
>>> msgpack.unpackb(_)
(b'\x01', b'\x02', b'\x03')

>>> msgpack.packb([1, 2, 3])
'b'\xc3\x01\x02\x03''
>>> msgpack.unpackb(_, use_list = True)
[b'\x01', b'\x02', b'\x03']

Example usage with sedes. This will decode to the variable types that you encoded from.

>>> import msgpack
>>> msgpack.packb([1, 2, 3])
'b'\xc3\x01\x02\x03''
>>> msgpack.unpackb(_)
(b'\x01', b'\x02', b'\x03')

>>> msgpack.packb([1, 2, 3])
'b'\xc3\x01\x02\x03''
>>> msgpack.unpackb(_, sedes=[1], use_list=True)
[1, 2, 3]

>>> msgpack.packb([b'\x01', [12312,1234]])
b'\xc8\x01\xc6\x820\x18\x82\x04\xd2'
>>> msgpack.unpackb(_, sedes=[0,[1]], use_list=True)
[b'\x01', [12312, 1234]]

>>> msgpack.packb([b'\x01', [12312,1234]])
b'\xc8\x01\xc6\x820\x18\x82\x04\xd2'
>>> msgpack.unpackb(_, sedes=[0,[1]], use_list=True)
[b'\x01', [12312, 1234]]

Metadata

Release files for msgpack-rlp-python 0.5.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for msgpack-rlp-python 0.5.8
File Actions
msgpack_rlp_python-0.5.8-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details for msgpack_rlp_python-0.5.8-cp36-cp36m-manylinux1_x86_64.whl
msgpack_rlp_python-0.5.8-cp36-cp36m-manylinux1_i686.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32 Details for msgpack_rlp_python-0.5.8-cp36-cp36m-manylinux1_i686.whl
msgpack_rlp_python-0.5.8-cp35-cp35m-manylinux1_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 Details for msgpack_rlp_python-0.5.8-cp35-cp35m-manylinux1_x86_64.whl
msgpack_rlp_python-0.5.8-cp35-cp35m-manylinux1_i686.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32 Details for msgpack_rlp_python-0.5.8-cp35-cp35m-manylinux1_i686.whl
msgpack_rlp_python-0.5.8-cp27-cp27mu-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64 Details for msgpack_rlp_python-0.5.8-cp27-cp27mu-manylinux1_x86_64.whl
msgpack_rlp_python-0.5.8-cp27-cp27mu-manylinux1_i686.whl CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-32 Details for msgpack_rlp_python-0.5.8-cp27-cp27mu-manylinux1_i686.whl
msgpack_rlp_python-0.5.8-cp27-cp27m-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64 Details for msgpack_rlp_python-0.5.8-cp27-cp27m-manylinux1_x86_64.whl
msgpack_rlp_python-0.5.8-cp27-cp27m-manylinux1_i686.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-32 Details for msgpack_rlp_python-0.5.8-cp27-cp27m-manylinux1_i686.whl

Total release size: 2.1 MB

Release files / msgpack_rlp_python-0.5.8-cp36-cp36m-manylinux1_x86_64.whl

Download URL msgpack_rlp_python-0.5.8-cp36-cp36m-manylinux1_x86_64.whl
Size 287.5 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
147b17f3cdb526f96e24aeb855c6e6d7da23b7964620b88b84c35294ad3e9df7
BLAKE2b-256 checksum
How to use checksums
039385e53cf571882fd855f4a6d8f2fb12d8c6d791a7894243e9d5621c49e623
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Release files / msgpack_rlp_python-0.5.8-cp36-cp36m-manylinux1_i686.whl

Download URL msgpack_rlp_python-0.5.8-cp36-cp36m-manylinux1_i686.whl
Size 267.6 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
758a93168a799470666a0c0187c2f30b7f5632f4db16366d7826ebce4385c14b
BLAKE2b-256 checksum
How to use checksums
5b7e63117c57c297920a8ff276f1fa129bd8925612376894f74f12dfcfb9e780
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Release files / msgpack_rlp_python-0.5.8-cp35-cp35m-manylinux1_x86_64.whl

Download URL msgpack_rlp_python-0.5.8-cp35-cp35m-manylinux1_x86_64.whl
Size 281.0 kB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
60e080a73d0b0ecf34474770f0eb61418dd66b240f0f9187c1659579138e9160
BLAKE2b-256 checksum
How to use checksums
a3cb57c3ea4e79ddfde3a85d8b280e0ee897ca0876a8b1523f92ccf70659429c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Release files / msgpack_rlp_python-0.5.8-cp35-cp35m-manylinux1_i686.whl

Download URL msgpack_rlp_python-0.5.8-cp35-cp35m-manylinux1_i686.whl
Size 259.5 kB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
8ea96f6ec42401ca339957586b60893f1175265f73ba80f821f3b04991d3b1e3
BLAKE2b-256 checksum
How to use checksums
dc83ae013131cf3559fa34d741b1b6e24591da97bf5350bdd6290dc228997993
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Release files / msgpack_rlp_python-0.5.8-cp27-cp27mu-manylinux1_x86_64.whl

Download URL msgpack_rlp_python-0.5.8-cp27-cp27mu-manylinux1_x86_64.whl
Size 264.2 kB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
b74e7b253140f65efeaa33f49b73f3899fe5f94a6ee78553362f3e0ac3a31da5
BLAKE2b-256 checksum
How to use checksums
2be2d76db300c236a425b76ed40e403d3e71e3c0d165293c76dade9c21fef4e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Release files / msgpack_rlp_python-0.5.8-cp27-cp27mu-manylinux1_i686.whl

Download URL msgpack_rlp_python-0.5.8-cp27-cp27mu-manylinux1_i686.whl
Size 245.9 kB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
87f6b855e06527ac1bd2ce9a017dda7148eb2a10c03e9c94f14a84d83b4b12c8
BLAKE2b-256 checksum
How to use checksums
880136e36cc5f14ff5e91515dc08a9fac6b9f4f46f71d1cc57e70a0fe5d5967f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Release files / msgpack_rlp_python-0.5.8-cp27-cp27m-manylinux1_x86_64.whl

Download URL msgpack_rlp_python-0.5.8-cp27-cp27m-manylinux1_x86_64.whl
Size 265.2 kB
Tags CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
1e81de71501cfbd9bcd28b6bbd2d7d03110a3cd8a91a7a976ac6367fb0527400
BLAKE2b-256 checksum
How to use checksums
15b108aaaf08048a54ced6f51f8cc6ae5f7841107698aff9212bb88f324c2e0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Release files / msgpack_rlp_python-0.5.8-cp27-cp27m-manylinux1_i686.whl

Download URL msgpack_rlp_python-0.5.8-cp27-cp27m-manylinux1_i686.whl
Size 246.0 kB
Tags CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
84bcec969d4ed792512bacf7187f445d427d3c6f1c137d2338afa702d808a0f6
BLAKE2b-256 checksum
How to use checksums
d18877d170709042066bc493888e5128a594af16f2f88ab71859c09055bf4707
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Security for msgpack-rlp-python 0.5.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.8 This release

8 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page