Install & Compatibility
Where this runs
tested against v0.45.0 · 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
py 3.10
✕ build_error
✓ 2.25s
py 3.12
✕ build_error
✓ 2.08s
py 3.13
✕ build_error
✓ 1.88s
py 3.9
✕ build_error
✕ build_error
33MB installed
● package 33MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
G1Element
✓ from chia_rs import G1Element
Represents a point on the G1 elliptic curve, often used for public keys in BLS signatures.
G2Element
✓ from chia_rs import G2Element
Represents a point on the G2 elliptic curve, often used for signatures in BLS.
PrivateKey
✓ from chia_rs import PrivateKey
Represents a BLS private key for cryptographic operations.
Program
✓ from chia_rs import Program
Represents a CLVM program, essential for Chia's smart transactions (Chialisp).
This quickstart demonstrates how to generate a BLS private key, derive its public key, sign a message, and verify the signature using the `chia-rs` library. This showcases fundamental cryptographic operations built into `chia-rs`.
import os
from chia_rs import PrivateKey, G1Element, G2Element
# Generate a random private key (seed should be truly random in production)
private_key = PrivateKey.from_seed(os.urandom(32))
print(f"Private Key (G1 Element Hex): {private_key.get_g1().serialize().hex()}")
# Derive the corresponding public key (G1Element)
public_key = private_key.get_g1()
print(f"Public Key (G1Element Hex): {public_key.serialize().hex()}")
# Sign a message
message = b"Hello, Chia blockchain!"
signature = private_key.sign(message)
print(f"Signature (G2Element Hex): {signature.serialize().hex()}")
# Verify the signature
is_valid = signature.verify(public_key, message)
print(f"Signature Valid: {is_valid}")
Debug
Known issues
breakingThe `run_block_generator*` functions underwent a breaking change in version 0.39.0, where the `allocator` argument was removed and is now returned directly by the function.fixIf upgrading from an earlier version, remove the `allocator` argument from calls to `run_block_generator*` and instead retrieve it from the function's return value.
affects: >=0.39.0
gotchaVersions of `chia-rs` are tightly coupled with specific Chia blockchain soft fork rules and consensus logic. Using an outdated `chia-rs` version with a newer blockchain (or vice versa) can lead to incorrect consensus validation, transaction processing, and network incompatibility. This is critical for changes introduced in versions like 0.40.0, 0.41.0, and 0.42.0, which implement new 'cost per spend' and 'spend limits' rules.fixAlways align your `chia-rs` version with the recommended version for the Chia blockchain network you are interacting with. Refer to the official Chia-Network/chia-blockchain changelog and release notes for compatibility details and mandatory soft fork upgrade deadlines.
affects: All versions, especially critical for >=0.40.0
gotchaWhile `chia-rs` is a Rust-backed library, its primary consumer, the `chia-blockchain` project, officially dropped support for Python 3.8. It is strongly recommended to use Python 3.9 or higher for any development involving `chia-rs` to ensure broad ecosystem compatibility and avoid potential issues.fixUpgrade your Python environment to 3.9 or newer. Python 3.10+ is often used in recent Chia ecosystem projects.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'chia_rs'
The Python interpreter cannot find the 'chia_rs' package, usually because it was not installed correctly, the virtual environment is not activated, or the installation path is not in the Python search path.
fixEnsure `chia-rs` is installed in your active Python environment. If using a virtual environment, activate it. If the package was not installed or corrupted, reinstall it: `pip install chia-rs`.
error: subprocess-exited-with-error × Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1
This error occurs during installation when `pip` attempts to build the `chia-rs` Python wheel from source, but the underlying Rust compilation process (handled by `maturin` and `cargo`) fails. This can be due to a missing Rust toolchain, incorrect environment setup, or platform-specific build issues.
fixInstall the Rust toolchain: `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`. Ensure `maturin` is installed (`pip install maturin`). If the error persists, check for system-level dependencies or platform-specific build instructions. Sometimes, using a pre-built wheel (if available for your OS/architecture/Python version) or upgrading `pip`/`setuptools` can help.
ImportError: cannot import name 'deserialize_and_run_program2' from 'clvm_rs'
This specific import error indicates a version mismatch or a corrupted installation of the `clvm_rs` library, which is a Rust-backed dependency within the Chia ecosystem. The Python bindings for `deserialize_and_run_program2` are either missing or incompatible with the installed `chia-blockchain` version.
fixReinstall `clvm_rs` to ensure compatibility, often by upgrading or reinstalling `chia-blockchain` itself, which manages its dependencies: `pip install --upgrade chia-blockchain` or `pip install --force-reinstall clvm_rs`.
ERROR: Could not find a version that satisfies the requirement clvm-rs==X.X.X (from chia-blockchain) (from versions: ...)
This error indicates that `pip` could not find a pre-built binary wheel for the specified version of `clvm-rs` (or `chia-rs`) that matches your operating system, architecture, and Python version. This often happens on less common platforms or when Python versions are very new.
fixEnsure your Python version and operating system are officially supported. Try updating `pip` (`pip install --upgrade pip`). If a specific version is required, try installing a slightly older or newer version if it has pre-built wheels. In some cases, you may need to build from source, which requires the Rust toolchain to be installed, but if pre-built distributions are simply missing, building from source is the only option, which may be what causes the 'subprocess-exited-with-error' described above if environment is not correctly set up for compilation.
Upgrade
Version history
0.45.0latest on PyPI · released Jun 5, 2026
Audit
Dependencies
No dependency data recorded yet.