--- id: trie version: "3.1.0" license: MIT license_treatment: permissive maintenance: active --- # trie — Python implementation of the Ethereum Trie structure License: permissive · Maintenance: active · Downloads: 313.5K/mo ## What it is and what it does This package provides a Python implementation of the Hexary Trie, the data structure used by Ethereum for storing account state and transaction data. It supports standard key-value operations (set, get, delete, exists) and can be used like a Python dictionary. The trie maintains a cryptographic root hash that changes deterministically when data is modified, making it useful for verifying state consistency across distributed systems. The package depends on eth-utils, hexbytes, rlp, sortedcontainers, and eth-hash to handle Ethereum-specific serialization, hashing, and data structures. It includes traversal APIs for inspecting internal trie structure and a fog-based walker for efficiently exploring large tries without loading all nodes into memory. Use it for: - Building Ethereum client implementations or state verification tools that need to reconstruct and validate blockchain state - Storing and querying hierarchical key-value data with cryptographic proofs of correctness - Implementing smart contract state backends or local blockchain simulators - Auditing or debugging Ethereum state by traversing trie structure and verifying node integrity - Prototyping distributed ledger systems that require deterministic, hashable state trees ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Implements the Ethereum Merkle Trie data structure for efficient key-value storage and retrieval with cryptographic root hashing. Yes. The package is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and installs with low friction. Install it if you are working with Ethereum state structures, building blockchain tooling, or need a production-grade Merkle Trie implementation in Python. ## Install pip install trie uv add trie poetry add trie ## Installing trie Before you install: Low install friction with a pure Python wheel. Active maintenance with recent commits and stable production status across Python 3.8–3.13. License in practice: MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects. Quickstart: from trie import HexaryTrie t = HexaryTrie(db={}) t.set(b'my-key', b'some-value') value = t.get(b'my-key') root = t.root_hash Verify before relying: - Performance characteristics (insertion/lookup speed, memory overhead) for large tries - Database backend compatibility beyond in-memory dict - Concurrency or thread-safety guarantees ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 313.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags ethereum trie implementation, merkle tree python, hexary trie, blockchain data structure, ethereum state storage, trie key-value store, cryptographic hash tree, ethereum, merkle-tree, cryptography [View on SkillFed](https://skillfed.io/packages/trie) · [View on PyPI](https://pypi.org/project/trie/)