Skip to main content

In order to understand Ethereum's core functionalities, I am implementing parts of it for myself. Here I am implementing the Merkle Patricia Trie (MPT) purely in Python 3.

Install

pip install ethereum-merkle-patricia-trie

Requirements

In order to use the package, you need to install LevelDb on your system.

Tests

In order to run the tests, execute the following command:

$ python -m unittest

Usage

Here an example on how to use the package:

from mpt.trie import Trie

t = Trie('./testdb')
t.update(b'abcd', b'hello world')

print(t.get_value(b'abcd'))

print(t.get_root_hash())

t.delete(b'abcd')

Upload to Pypi

Uploading and testing using test Pypi

python -m build
python -m twine upload --repository testpypi dist/*
pip install --index-url https://test.pypi.org/simple/ --no-deps merklePatriciaTrie

Uploading to Pypi

python -m build
python -m twine upload dist/*

Contributions

Create a new virtual environment and install all dependencies:

python3 -m virtualenv --python /path/to/python3 venv
source ./venv/bin/activate
pip install -r requirements.txt

Install the pre-commit hooks using the following command:

pre-commit install

Metadata

Release files for ethereum-merkle-patricia-trie 0.0.3

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

Source distribution (sdist)

Source distribution for ethereum-merkle-patricia-trie 0.0.3
File Size Uploaded Provenance Actions
ethereum-merkle-patricia-trie-0.0.3.tar.gz 6.9 kB Without provenance Details for ethereum-merkle-patricia-trie-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ethereum-merkle-patricia-trie 0.0.3
File Interpreter ABI Platform Actions
ethereum_merkle_patricia_trie-0.0.3-py3-none-any.whl Python 3 none any Details for ethereum_merkle_patricia_trie-0.0.3-py3-none-any.whl

Total release size: 14.2 kB

Release files / ethereum-merkle-patricia-trie-0.0.3.tar.gz

Download URL ethereum-merkle-patricia-trie-0.0.3.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
49bcdfca0cdbd92a5850173d44d4c8ab09984922c2a579a0ed6df987a45493c7
BLAKE2b-256 checksum
How to use checksums
67e2f6357e1fe694d358afe8e097e9861504db0957db7fc8e2b0a7949ebb1c15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / ethereum_merkle_patricia_trie-0.0.3-py3-none-any.whl

Download URL ethereum_merkle_patricia_trie-0.0.3-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
666d237e9ca18d33f2941e0eeb674df12583898a9300a17f1bdc621f2110c443
BLAKE2b-256 checksum
How to use checksums
2c5149eb50c80aa6fd07a8a8b1037a9eaac590db12b7aaf0c370a2132e606194
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Security for ethereum-merkle-patricia-trie 0.0.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