Pure Python 3 Merkle Patricia Trie implementation
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for ethereum-merkle-patricia-trie-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49bcdfca0cdbd92a5850173d44d4c8ab09984922c2a579a0ed6df987a45493c7 |
|
MD5 | 99f71a28f07348f7ef5e1cd6d69c7b79 |
|
BLAKE2b-256 | 67e2f6357e1fe694d358afe8e097e9861504db0957db7fc8e2b0a7949ebb1c15 |
Close
Hashes for ethereum_merkle_patricia_trie-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 666d237e9ca18d33f2941e0eeb674df12583898a9300a17f1bdc621f2110c443 |
|
MD5 | 87e1919ce5771dfdb4a1fe61f47f608c |
|
BLAKE2b-256 | 2c5149eb50c80aa6fd07a8a8b1037a9eaac590db12b7aaf0c370a2132e606194 |