Chialisp Standard Library

raw JSON →
0.1.1 verified Fri May 01 auth: no python

A standard library of Chialisp `.clib` files for use with the Chia blockchain. It provides common utility functions and macros for writing Chialisp smart contracts. Version 0.1.1 is the latest, but the library is in early development with an undefined release cadence.

pip install chialisp-stdlib
error ModuleNotFoundError: No module named 'chialisp_stdlib'
cause The package is installed as 'chialisp-stdlib' but import uses underscore.
fix
Ensure you installed the package correctly: pip install chialisp-stdlib. Import with from chialisp_stdlib import load_clib.
error FileNotFoundError: [Errno 2] No such file or directory: 'condition_codes.clib'
cause The load_clib function expects the filename without path; it searches inside the package data.
fix
Make sure you pass only the base filename (e.g., 'condition_codes.clib'), not a full path.
deprecated The library version 0.1.1 is very early and may have breaking changes in future releases.
fix Pin to a specific version and watch the repository for updates.
gotcha The library only provides raw .clib file content as strings. It does not compile or execute Chialisp. You need clvm-tools or another compiler to use the loaded code.
fix Install a Chialisp compiler (e.g., clvm-tools) and handle file inclusion in your build pipeline.
gotcha The package name uses a hyphen (chialisp-stdlib), but the import module uses an underscore (chialisp_stdlib).
fix Use `from chialisp_stdlib import ...` in your Python code.

Import the library and load a .clib file as a string for use in your Chialisp compiler pipeline.

from chialisp_stdlib import load_clib

# Load a standard library file as a string
stdlib_code = load_clib('condition_codes.clib')
print(stdlib_code[:100])

# Alternatively, include during compilation (requires clvm_tools)
# from clvm_tools import compile_clvm
# compile_clvm('my_contract.clsp', include='./chialisp_stdlib')