OpenViSTAI · Agents · Blockchain · Crypto
Menu
Developer Tools

Pymerkletools

Pymerkletools is a Python library for creating Merkle trees, generating inclusion proofs for leaves, and validating proofs against a Merkle root.

Independent OpenViST project profile, based on linked sources.

Pymerkletools — OpenViST project profile in Developer Tools.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when a Python application needs Merkle-tree construction and inclusion-proof operations as components of a broader integrity workflow.

Who it is for

  • Python developers implementing Merkle-based data-integrity workflows.
  • Developers who need to create tree roots and verify a record's inclusion using a proof.

Documented uses

  • Add individual values or batches of values as tree leaves.
  • Build a Merkle tree and retrieve its root.
  • Generate a proof for a leaf by index.
  • Validate that a target hash and proof connect to a supplied root.
Before you choose

Requirements & limits

  • The README specifies SHA-256 as the default and lists additional hash algorithms.
  • SHA-3 use depends on the pysha3 package; the README says it is installed as part of the module or can be installed separately.
  • Leaves supplied without hashing must be hexadecimal strings; non-hex values can be hashed before insertion.
  • The tree must be rebuilt after adding leaves or resetting it before root and proof retrieval.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Build a Merkle tree and validate a leaf proof

Create a tree from values, retrieve a proof for a leaf and check it against the tree root.

Before you start

  • Python environment with the merkletools package installed using pip install merkletools.
  • Values to add as hexadecimal strings, or values that can be hashed with do_hash=True.

Steps

  1. Import merkletools and create a MerkleTools object.

  2. Add one or more leaves, enabling do_hash for non-hex input.

  3. Call make_tree() and retrieve the root with get_merkle_root().

  4. Retrieve a leaf proof with get_proof(index) and pass it, the target leaf hash and root to validate_proof().

Expected outcome

A Merkle root and a boolean result indicating whether the supplied proof connects the target hash to that root.

Guide limitations

  • The tree must be built before its root and proofs are available.
  • The target hash and root supplied to validation must be hexadecimal strings.
  • The README's common-usage example uses Python 2-style print statements.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
16 October 2026
Original website title
Tierion/pymerkletools · Official homepage title · retained in its source language