Python implementation of the Ethereum Trie structure
Project description
# Python Implementation of the Ethereum Trie structure
`shell $ pip install trie `
> Warning: This is an early release and is likely to contain bugs as well as > breaking API changes.
# Usage
`python >>> from trie import Trie >>> t = Trie(db={}) >>> t.root_hash b'V\xe8\x1f\x17\x1b\xccU\xa6\xff\x83E\xe6\x92\xc0\xf8n[H\xe0\x1b\x99l\xad\xc0\x01b/\xb5\xe3c\xb4!' >>> t.set(b'my-key', b'some-value') >>> t.get(b'my-key') b'some-value' >>> t.exists(b'another-key') False >>> t.set(b'another-key', b'another-value') >>> t.exists(b'another-key') True >>> t.delete(b'another-key') >>> t.exists(b'another-key') False `
You can also use it like a dictionary.
`python >>> from trie import Trie >>> t = Trie(db={}) >>> t.root_hash b'V\xe8\x1f\x17\x1b\xccU\xa6\xff\x83E\xe6\x92\xc0\xf8n[H\xe0\x1b\x99l\xad\xc0\x01b/\xb5\xe3c\xb4!' >>> t[b'my-key'] = b'some-value' >>> t[b'my-key'] b'some-value' >>> b'another-key' in t False >>> t[b'another-key'] = b'another-value' >>> b'another-key' in t True >>> del t[b'another-key'] >>> b'another-key' in t False `
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trie-0.3.0.tar.gz.
File metadata
- Download URL: trie-0.3.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29da2d717bb2ee2ca8344b83cf8c44ac1225f67842c3c2fb4299e1e0c62aa0c7
|
|
| MD5 |
176b409315b19faaffa061142a061dfc
|
|
| BLAKE2b-256 |
2cedfcffd4df11c7c4fecbed29e456efd38dd5380534408d21fa502bab4ca6c9
|
File details
Details for the file trie-0.3.0-py3-none-any.whl.
File metadata
- Download URL: trie-0.3.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
764d847c5a2a7f29006805f77bed6164a0a3130c5ef80ab9d702b6904552b3c6
|
|
| MD5 |
e941effe10575ce76c0e00f5af74bbd2
|
|
| BLAKE2b-256 |
390cc4b475fbda30d4c32bc57cd22cb8edb90492c10cd294a9f41eae7faa69c0
|