Registry / serialization / chiavdf

chiavdf

JSON →
library1.1.14pypypi✓ verified 86d ago

chiavdf is a Python library that provides bindings for a C++ implementation of Verifiable Delay Functions (VDFs), primarily used within the Chia blockchain ecosystem. It allows for the creation of discriminants and verification of Wesolowski proofs. The library is actively maintained with frequent updates, often including improvements to the underlying C++ components and build processes. Current version is 1.1.14.

pip install chiavdf
INSTALL
IMPORT
SIG · CHIAVDF
C
chiavdf
serializationpythonv1.1.14
Install
1.6s avg
Import
Disk
17MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1.14 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 1.7s
py 3.11
✕ build_error
✓ 1.68s
py 3.12
✕ build_error
✓ 1.55s
py 3.13
✕ build_error
✓ 1.58s
py 3.9
✕ build_error
✕ build_error
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

verify_wesolowski
from chiavdf import verify_wesolowski
verify_vdf
from chiavdf import verify_vdf
create_discriminant
from chiavdf import create_discriminant

This quickstart demonstrates how to import and use `chiavdf` to create a discriminant and verify a Wesolowski proof. Note that the `x_value` and `proof_bytes` in this example are placeholders and will likely not result in a valid proof. You should replace them with actual data from a VDF prover for successful verification.

import chiavdf import hashlib # Example input data (replace with actual challenge, x, and proof from your VDF) # For a real VDF proof, challenge_hash, x_value, and proof_bytes would be specific outputs # from a VDF prover. challenge_seed = b"my_unique_vdf_challenge_seed_001" challenge_hash = hashlib.sha256(challenge_seed).digest() form_size = 512 # Standard form size for Chia num_iterations = 1_000_000 # Number of iterations the VDF ran for n_wesolowski = 600 # Wesolowski proof parameter # Dummy x and proof bytes for demonstration. These values will likely result in 'False' # or an error if not actual valid proof components. x_value = b"\x01" * 64 # Placeholder for a 64-byte value proof_bytes = b"\x02" * 128 # Placeholder for a 128-byte proof try: # Create the discriminant based on the challenge hash discriminant = chiavdf.create_discriminant(challenge_hash, form_size) # Verify the Wesolowski proof # In a real scenario, x_value and proof_bytes must correspond to a valid VDF computation is_valid = chiavdf.verify_wesolowski( challenge_hash, form_size, discriminant, x_value, proof_bytes, num_iterations, n_wesolowski, 1, # num_threads (can be increased for faster verification on multi-core CPUs) True, # check_input ) print(f"VDF Wesolowski proof verification result: {is_valid}") except ValueError as e: print(f"Input Error during VDF verification: {e}") except Exception as e: print(f"An unexpected error occurred during VDF verification: {e}")
Debug
Known issues
breakingWhen compiling `chiavdf` from source (not installing via `pip install` which uses pre-built wheels), the underlying Boost library linkage changed significantly in versions 1.1.12 and 1.1.13. The `boost_system` library was removed from Boost distributions.
fix
If compiling from source, ensure your build scripts or CMake configurations are updated to remove references to `-lboost_system` or `boost_system` during linking. For most users, `pip install` provides pre-compiled wheels, avoiding this issue.
affects: >=1.1.12
gotchaThe `chiavdf` library requires Python 3.9 or newer. Installing with older Python versions will fail or result in compatibility issues.
fix
Ensure your Python environment is running Python 3.9 or a newer version (e.g., Python 3.10, 3.11, 3.12, 3.14 are supported in latest versions). Upgrade your Python installation if necessary.
affects: All (explicitly stated as >=3.9 in PyPI since recent versions)
gotchaVDF verification is a computationally intensive process. The `num_threads` parameter in `verify_wesolowski` and `verify_vdf` can significantly impact performance. Setting it too high or too low might not yield optimal results.
fix
Experiment with the `num_threads` parameter based on your CPU's core count. Typically, setting it to the number of physical cores or slightly less than logical cores provides a good balance. For most verification tasks, 1 thread is sufficient unless benchmarking.
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'chiavdf'
The 'chiavdf' library is not installed in your current Python environment.
fix
Install the library using pip: `pip install chiavdf`
AttributeError: module 'chiavdf' has no attribute 'verify_proof'
You are attempting to call a function or access an attribute that does not exist or has been misspelled within the `chiavdf` module.
fix
Check the exact function names from the official documentation or the `__init__.pyi` file. Common functions are `verify_wesolowski`, `verify_vdf`, and `create_discriminant`.
TypeError: argument 'challenge_hash' must be bytes, not str
Input parameters like `challenge_hash`, `x_value`, and `proof_bytes` are expected to be byte strings (e.g., `b'...'`), but a regular string was provided.
fix
Ensure all binary data inputs are properly encoded as `bytes`. For example, use `my_string.encode('utf-8')` or prefix string literals with `b` (e.g., `b'some_data'`).
Upgrade
Version history
1.1.14latest on PyPI · released Nov 5, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
26 hits · last 30 days
node
22
Amazon
1
OpenAI (training)
1
Resources
chiavdf — pip install chiavdf · libregistry