This release is a pre-release and may not be stable for production use.
Cardano Client Bindings — Python
Python bindings for Cardano Client Lib
via the Cardano Client Bindings native library. Pure ctypes — no JVM, no compiler, no C extension.
Part of the Cardano Client Bindings project. See the top-level README for the full API reference and
docs/quicktx.mdfor transaction building.
Requirements
- Python 3.8+
The native library is bundled inside the platform wheel — no separate download or
CCL_LIB_PATH needed for an installed package.
Installing
Recommended — a platform wheel that bundles the native library:
pip install cardano-client-lib
# or, a locally built wheel:
pip install path/to/cardano_client_lib-*.whl
Wheels are published for linux-x86_64, linux-aarch64, linux-musl-x86_64 (Alpine),
macos-aarch64, and windows-x86_64. There is no source distribution — on any other platform,
build libccl from source and point CCL_LIB_PATH at it (see below).
The distribution is named cardano-client-lib, but the import stays short: import ccl. The wheel
ships the matching libccl.* inside the package (ccl/_libs/), so import ccl just works — nothing
else to set. Build one locally (needs pip install build):
./gradlew :wrappers:python:wheel # -> wrappers/python/dist/cardano_client_lib-*.whl
At load time the bindings look for the library in this order: an explicit CclLib(lib_path=...),
the CCL_LIB_PATH env var, then the bundled ccl/_libs/ copy.
Development — against a locally built library (no wheel): point CCL_LIB_PATH at a directory
containing libccl.{dylib,so,dll}:
./gradlew :core:nativeCompile # produces core/build/native/nativeCompile/libccl.*
export CCL_LIB_PATH=core/build/native/nativeCompile
# (or: make download-lib to fetch a pre-built binary)
Running the examples
The package finds the library via the CCL_LIB_PATH environment variable, and the OS
loader needs it on its search path too. From the repo root:
LIB_DIR=core/build/native/nativeCompile
PYTHONPATH=wrappers/python \
CCL_LIB_PATH=$LIB_DIR \
DYLD_LIBRARY_PATH=$LIB_DIR \
LD_LIBRARY_PATH=$LIB_DIR \
python3 wrappers/python/examples/01_account_and_keys.py
(DYLD_LIBRARY_PATH is for macOS, LD_LIBRARY_PATH for Linux — set both, the unused one
is harmless.)
The examples/ directory contains:
| File | What it shows |
|---|---|
01_account_and_keys.py |
Create an account, restore from mnemonic, derive keys and a DRep ID |
02_primitives.py |
Mnemonics, Blake2b hashing, Ed25519 signing, address parsing/validation |
03_build_and_sign_tx.py |
Build an unsigned payment offline (QuickTx) and sign it — no node/DevKit needed |
Quick start
from ccl import CclLib, Network
lib = CclLib() # loads libccl, starts a GraalVM isolate
try:
account = lib.account.create(Network.TESTNET)
print(account["base_address"]) # addr_test1...
print(account["mnemonic"]) # 24-word phrase
finally:
lib.close() # tears down the isolate
API namespaces
A CclLib instance exposes these namespaces (all offline operations):
| Namespace | Examples |
|---|---|
lib.account |
create, from_mnemonic, get_private_key, get_public_key, get_drep_id, sign_tx |
lib.address |
info, validate, to_bytes, from_bytes |
lib.crypto |
blake2b_256, blake2b_224, generate_mnemonic, validate_mnemonic, sign, verify |
lib.tx |
hash, sign_with_secret_key, to_json, from_json, deserialize |
lib.plutus |
data_hash, data_to_json, data_from_json |
lib.script |
native_from_json, hash |
lib.gov |
drep_key_from_mnemonic, committee_cold_key_from_mnemonic, committee_hot_key_from_mnemonic |
lib.wallet |
create, from_mnemonic, get_address |
lib.quicktx |
build(yaml, utxos, protocol_params) — build an unsigned tx from a TxPlan YAML document |
Networks
Every key-derivation and signing call takes a required network — Network.MAINNET,
Network.TESTNET, Network.PREPROD or Network.PREVIEW. There is no default: a library that
derives keys must not guess, least of all guess mainnet.
Networkis CCL's enum ordinal, not Cardano's on-chain network id. The two differ, and for mainnet/testnet they are inverted:
Member Value you pass On-chain network_idof the addressNetwork.MAINNET0 1 Network.TESTNET1 0 Network.PREPROD2 0 Network.PREVIEW3 0 So do not pass a
network_idyou read off an address back into these APIs — you would flip mainnet and testnet.lib.address.info(addr)["network_id"]is the real on-chain id and is a different thing from theNetworkyou passed in.
Network is an IntEnum, so a plain int 0-3 still works, and an out-of-range value raises
ValueError at the call rather than failing obscurely inside the native library.
Errors raise ccl.CclError.
Transactions are defined as a TxPlan YAML document and built fully offline — you supply the UTXOs and protocol parameters:
result = lib.quicktx.build(txplan_yaml, utxos, protocol_params) # -> {"tx_cbor","tx_hash","fee"}
See examples/03_build_and_sign_tx.py.
Chain-data providers (optional)
build() is offline — you supply the UTXOs and protocol parameters. The optional providers fetch
those for you over HTTP (stdlib urllib), so the native library stays offline and provider-free:
from ccl import CclLib, YaciProvider, BlockfrostProvider
lib = CclLib()
provider = BlockfrostProvider(project_id, network="preprod") # or YaciProvider()
result = lib.quicktx.build_with(txplan_yaml, provider, sender_address)
Plug in any backend (Koios, Ogmios, …) by supplying an object with utxos(address) and
protocol_params(). UTXO selection is handled inside the bridge — a provider only returns all
UTXOs at the address.
Transaction evaluators (optional)
A Plutus build needs each redeemer's execution units. The bridge computes them offline with Scalus when you supply none — so a script build just works, no evaluation step:
result = lib.quicktx.build_with(txplan_yaml, provider, sender_address) # Scalus computes the units
To use a remote evaluator instead (e.g. an authoritative fallback), pass a
TransactionEvaluator; build_with runs a two-pass (draft → evaluate → rebuild). libccl never
makes HTTP calls (ADR-0013), so remote evaluation
lives here in the wrapper:
from ccl import BlockfrostEvaluator
evaluator = BlockfrostEvaluator(project_id, network="preprod")
result = lib.quicktx.build_with(txplan_yaml, provider, sender_address, evaluator=evaluator)
Plug in any evaluator (Ogmios, …) by supplying an object with evaluate(tx_cbor, utxos). To supply
units you computed yourself, call build(..., exec_units=…) directly. See
examples/04_plutus_evaluator.py.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cardano_client_lib-0.1.0rc6-py3-none-win_amd64.whl.
File metadata
- Download URL: cardano_client_lib-0.1.0rc6-py3-none-win_amd64.whl
- Upload date:
- Size: 26.4 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0dd3bc3d8d8fcf276f0eeeda645817719f78d67820566dcf4b64cf4dba9899e
|
|
| MD5 |
04cd1ce2530e06aa031253007627e5ef
|
|
| BLAKE2b-256 |
cbdd024997336f95c0f2b27df7beab3b40b5e7aa020e0d812c437227a663313b
|
Provenance
The following attestation bundles were made for cardano_client_lib-0.1.0rc6-py3-none-win_amd64.whl:
Publisher:
publish-py.yml on bloxbean/cardano-client-bindings
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cardano_client_lib-0.1.0rc6-py3-none-win_amd64.whl -
Subject digest:
e0dd3bc3d8d8fcf276f0eeeda645817719f78d67820566dcf4b64cf4dba9899e - Sigstore transparency entry: 2603486304
- Sigstore integration time:
-
Permalink:
bloxbean/cardano-client-bindings@581444b7a740dcc12446bf347ac139e95a109313 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/bloxbean
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-py.yml@581444b7a740dcc12446bf347ac139e95a109313 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file cardano_client_lib-0.1.0rc6-py3-none-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: cardano_client_lib-0.1.0rc6-py3-none-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 26.4 MB
- Tags: Python 3, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cee5e18763587925100429f737dffe5ce76db020b4c7b0174afbf29fcb33a777
|
|
| MD5 |
524a9412828ffee71d77a81b4810b393
|
|
| BLAKE2b-256 |
d8fe8917e5623ef85708cf129812a892e9535acada31fbce3d45f88671e46ef3
|
Provenance
The following attestation bundles were made for cardano_client_lib-0.1.0rc6-py3-none-musllinux_1_2_x86_64.whl:
Publisher:
publish-py.yml on bloxbean/cardano-client-bindings
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cardano_client_lib-0.1.0rc6-py3-none-musllinux_1_2_x86_64.whl -
Subject digest:
cee5e18763587925100429f737dffe5ce76db020b4c7b0174afbf29fcb33a777 - Sigstore transparency entry: 2603486117
- Sigstore integration time:
-
Permalink:
bloxbean/cardano-client-bindings@581444b7a740dcc12446bf347ac139e95a109313 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/bloxbean
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-py.yml@581444b7a740dcc12446bf347ac139e95a109313 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file cardano_client_lib-0.1.0rc6-py3-none-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: cardano_client_lib-0.1.0rc6-py3-none-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 26.4 MB
- Tags: Python 3, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6abd175bbc4275374d299a2740bb8c8ae88670ddb00426babc351bd92f1370f
|
|
| MD5 |
9e3644db2bc7b391037c3e51a25a4907
|
|
| BLAKE2b-256 |
346a324543ac1859bda2471f0327a215169eb68bf0b9008c828455e08d3d2ac6
|
Provenance
The following attestation bundles were made for cardano_client_lib-0.1.0rc6-py3-none-manylinux_2_28_x86_64.whl:
Publisher:
publish-py.yml on bloxbean/cardano-client-bindings
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cardano_client_lib-0.1.0rc6-py3-none-manylinux_2_28_x86_64.whl -
Subject digest:
f6abd175bbc4275374d299a2740bb8c8ae88670ddb00426babc351bd92f1370f - Sigstore transparency entry: 2603486185
- Sigstore integration time:
-
Permalink:
bloxbean/cardano-client-bindings@581444b7a740dcc12446bf347ac139e95a109313 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/bloxbean
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-py.yml@581444b7a740dcc12446bf347ac139e95a109313 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file cardano_client_lib-0.1.0rc6-py3-none-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: cardano_client_lib-0.1.0rc6-py3-none-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 26.4 MB
- Tags: Python 3, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61694cc4777345d2a05cd5d735884514d4a2f926ac135de2f651356c64e9d604
|
|
| MD5 |
538bb945d3ff77cec3cd270a780cde82
|
|
| BLAKE2b-256 |
8260efffdbe148d531f03e573db406a0300c0e9d670d6ed1a53464426c7d0fcc
|
Provenance
The following attestation bundles were made for cardano_client_lib-0.1.0rc6-py3-none-manylinux_2_28_aarch64.whl:
Publisher:
publish-py.yml on bloxbean/cardano-client-bindings
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cardano_client_lib-0.1.0rc6-py3-none-manylinux_2_28_aarch64.whl -
Subject digest:
61694cc4777345d2a05cd5d735884514d4a2f926ac135de2f651356c64e9d604 - Sigstore transparency entry: 2603486482
- Sigstore integration time:
-
Permalink:
bloxbean/cardano-client-bindings@581444b7a740dcc12446bf347ac139e95a109313 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/bloxbean
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-py.yml@581444b7a740dcc12446bf347ac139e95a109313 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file cardano_client_lib-0.1.0rc6-py3-none-macosx_15_0_arm64.whl.
File metadata
- Download URL: cardano_client_lib-0.1.0rc6-py3-none-macosx_15_0_arm64.whl
- Upload date:
- Size: 26.4 MB
- Tags: Python 3, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7ed43a6a80103dc000f4eaa89140a7d2544f8d2978b5fadef5647f6911fd194
|
|
| MD5 |
97f1cf81da7c376942f493c6f2d7571e
|
|
| BLAKE2b-256 |
ddb35639a503537530e00597638d3fce73361a33c6478e3a3454da8171f5f918
|
Provenance
The following attestation bundles were made for cardano_client_lib-0.1.0rc6-py3-none-macosx_15_0_arm64.whl:
Publisher:
publish-py.yml on bloxbean/cardano-client-bindings
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cardano_client_lib-0.1.0rc6-py3-none-macosx_15_0_arm64.whl -
Subject digest:
a7ed43a6a80103dc000f4eaa89140a7d2544f8d2978b5fadef5647f6911fd194 - Sigstore transparency entry: 2603486382
- Sigstore integration time:
-
Permalink:
bloxbean/cardano-client-bindings@581444b7a740dcc12446bf347ac139e95a109313 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/bloxbean
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-py.yml@581444b7a740dcc12446bf347ac139e95a109313 -
Trigger Event:
workflow_dispatch
-
Statement type: