chia-base

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

Common types and simple utilities used throughout the Chia blockchain codebase. Version 0.1.7 is the latest release. The project appears to be in early development with no frequent release cadence.

pip install chia-base
error ImportError: cannot import name 'Coin' from 'chia_base'
cause Incorrect import path. Some submodules may have different structure.
fix
Verify the available exports by checking the package's __init__.py. Use from chia_base import Coin if available.
error AttributeError: 'bytes' object has no attribute 'hex' (or similar)
cause Passing raw bytes/str instead of chia_base custom types.
fix
Wrap arguments with the appropriate type, e.g., bytes32(your_bytes)
gotcha The library is in early development (v0.1.7). APIs may change without notice. Pin your dependency to a specific version.
fix Use `pip install chia-base==0.1.7`
gotcha Type checking with custom types like bytes32 and uint64 may require explicit conversion from standard Python types. Passing raw bytes or ints might not work directly.
fix Wrap values with the appropriate type constructor: bytes32(b'...') or uint64(1000)

Basic usage: create a Coin object with required fields.

from chia_base import Coin, bytes32, uint64

coin = Coin(
    parent_coin_info=bytes32(b'\x00'*32),
    puzzle_hash=bytes32(b'\x01'*32),
    amount=uint64(1000)
)
print(coin)