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

Because it is based on msgpack, with a back-end in cython, it is lightning fast.

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 0.6.3

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 0.6.3
File Actions
msgpack_rlp-0.6.3-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details for msgpack_rlp-0.6.3-cp36-cp36m-manylinux1_x86_64.whl
msgpack_rlp-0.6.3-cp36-cp36m-manylinux1_i686.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32 Details for msgpack_rlp-0.6.3-cp36-cp36m-manylinux1_i686.whl
msgpack_rlp-0.6.3-cp35-cp35m-manylinux1_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 Details for msgpack_rlp-0.6.3-cp35-cp35m-manylinux1_x86_64.whl
msgpack_rlp-0.6.3-cp35-cp35m-manylinux1_i686.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32 Details for msgpack_rlp-0.6.3-cp35-cp35m-manylinux1_i686.whl
msgpack_rlp-0.6.3-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-0.6.3-cp27-cp27mu-manylinux1_x86_64.whl
msgpack_rlp-0.6.3-cp27-cp27mu-manylinux1_i686.whl CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-32 Details for msgpack_rlp-0.6.3-cp27-cp27mu-manylinux1_i686.whl
msgpack_rlp-0.6.3-cp27-cp27m-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64 Details for msgpack_rlp-0.6.3-cp27-cp27m-manylinux1_x86_64.whl
msgpack_rlp-0.6.3-cp27-cp27m-manylinux1_i686.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-32 Details for msgpack_rlp-0.6.3-cp27-cp27m-manylinux1_i686.whl

Total release size: 2.1 MB

Release files / msgpack_rlp-0.6.3-cp36-cp36m-manylinux1_x86_64.whl

Download URL msgpack_rlp-0.6.3-cp36-cp36m-manylinux1_x86_64.whl
Size 288.2 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
5184316afb3ecfeb05033bd1a5e11ca1ca3a1bf22aaf314db1605a05089a9c90
BLAKE2b-256 checksum
How to use checksums
cd2e6a8c8d37990e5395cfea99578e8bd016299c03d400de26b3f06b15868063
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.23.4 CPython/3.6.5

Release files / msgpack_rlp-0.6.3-cp36-cp36m-manylinux1_i686.whl

Download URL msgpack_rlp-0.6.3-cp36-cp36m-manylinux1_i686.whl
Size 268.2 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
5131666ee82477ba6da71e6c7d3e30d963130817254ac2e7f7dce23bc084ecd6
BLAKE2b-256 checksum
How to use checksums
e0c92247b4f0573c5d8a3a9098a026af6f14654d093f5f906735449f6d0b1001
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.23.4 CPython/3.6.5

Release files / msgpack_rlp-0.6.3-cp35-cp35m-manylinux1_x86_64.whl

Download URL msgpack_rlp-0.6.3-cp35-cp35m-manylinux1_x86_64.whl
Size 281.6 kB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
f36e84856cc7ab3bc471a122378e9593c1f414ebd40c250c29d1fd6edde301fb
BLAKE2b-256 checksum
How to use checksums
945fa31a960b6c376124c7c7a47512b8cc187538d4a80690a8ceeed376b7ffef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.23.4 CPython/3.6.5

Release files / msgpack_rlp-0.6.3-cp35-cp35m-manylinux1_i686.whl

Download URL msgpack_rlp-0.6.3-cp35-cp35m-manylinux1_i686.whl
Size 259.7 kB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
61aa00123fe63bc993c9f0b3a4d08fde64cebb76c06a46e3996ac60da461a6d6
BLAKE2b-256 checksum
How to use checksums
9c6a8a9fe5a032079ef36aeab90b5c1e64ad35f5221d559b5eb12a3e434d7c45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.23.4 CPython/3.6.5

Release files / msgpack_rlp-0.6.3-cp27-cp27mu-manylinux1_x86_64.whl

Download URL msgpack_rlp-0.6.3-cp27-cp27mu-manylinux1_x86_64.whl
Size 264.3 kB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
0282085e9265a2b46be807b984b4234cf116fbce98142f6528114088c1b3c2a3
BLAKE2b-256 checksum
How to use checksums
92dcecc1c877484b073b667bb4aa7d236ceaf6b601b8737dd1c48a222a54949b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.23.4 CPython/3.6.5

Release files / msgpack_rlp-0.6.3-cp27-cp27mu-manylinux1_i686.whl

Download URL msgpack_rlp-0.6.3-cp27-cp27mu-manylinux1_i686.whl
Size 246.3 kB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
f2cbd8ad835382620eefccc9ba65fed703fd467c6fa4ca2b1909411b9b9f2b7d
BLAKE2b-256 checksum
How to use checksums
4205e8c84dfca380662f508e79f4fff11c14f8d18ba10d311a5f2f848db95591
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.23.4 CPython/3.6.5

Release files / msgpack_rlp-0.6.3-cp27-cp27m-manylinux1_x86_64.whl

Download URL msgpack_rlp-0.6.3-cp27-cp27m-manylinux1_x86_64.whl
Size 265.3 kB
Tags CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
9a8a78723298cb68fff225e83589d03a84f9da01983cb05610193768df3c3862
BLAKE2b-256 checksum
How to use checksums
c4e905053f2e5112efd0c1fd7ad387b0e0b03795038c3f5f9d742595a728e00f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.23.4 CPython/3.6.5

Release files / msgpack_rlp-0.6.3-cp27-cp27m-manylinux1_i686.whl

Download URL msgpack_rlp-0.6.3-cp27-cp27m-manylinux1_i686.whl
Size 246.4 kB
Tags CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
73188641e04e0d05c8aba94e8e3a021a5fe333528c02750ce1746c8c057be8e9
BLAKE2b-256 checksum
How to use checksums
8b70019605a7f8e59c4b3451b39297d8e6a223f3669ae58b827fadfd9d521e98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.23.4 CPython/3.6.5

Security for msgpack-rlp 0.6.3

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.

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