Skip to main content

zanii-chain

Python client SDK for the Zanii L1 blockchain (RPC at https://blockchain.zanii.agency): keys, canonical signing, transactions, session keys, payment streams, and the AgentWallet adapter for AI agents.

Not the identity SDK. The zanii package on PyPI is the Zanii agent-identity and proof-of-action product (did:key, delegation certs, receipts, ledger.zanii.agency). This package, zanii-chain, is the blockchain client. They are designed to work together.

Install

pip install zanii-chain

Python 3.10+. Depends on PyNaCl, blake3, bech32, and msgpack.

Use

from zanii_chain import Wallet, ZaniiClient, ZAN

client = ZaniiClient("https://blockchain.zanii.agency")
wallet = Wallet.generate()                 # or Wallet.from_seed_hex(hex)

client.faucet(wallet.address)              # devnet
client.transfer(wallet, "zan1...", 1 * ZAN)

# agent-native: authorize a scoped session key, then open a payment stream
import time
client.session_authorize(wallet, agent_pubkey,
                         int(time.time()*1000) + 7*86_400_000, 5 * ZAN)
client.stream_open(wallet, "zan1payee...", rate_zi_per_s=1000, deposit_zi=1 * ZAN)

Give an AI agent a wallet

from zanii_chain import AgentWallet

# the owner authorized this agent's session key with a 5 ZAN cap
agent = AgentWallet("https://blockchain.zanii.agency", AGENT_SEED, OWNER_ADDRESS)
agent.pay("zan1provider...", amount_zan=0.25)
agent.open_stream("zan1api...", rate_zan_per_second=0.001, deposit_zan=2.0)

tools = agent.openai_tools()               # JSON tool schemas for any LLM
result = agent.call_tool("balance", "{}")  # dispatch a tool call, get a string

AgentWallet methods return plain strings for the LLM, and call_tool never raises into the agent loop. LangChain and CrewAI can consume the bound methods (agent.pay, agent.open_stream, ...) as plain-function tools.

Guarantees

Encodings and signatures are byte-identical to the Zanii reference node: a transaction built here validates and executes on-chain unchanged, and matches the JavaScript SDK (@zanii/chain) byte-for-byte. Amounts are zi (1 ZAN = 10^9 zi), integers only, never floats.

Apache 2.0 · info@zanii.agency · https://blockchain.zanii.agency

Metadata

Release files for zanii-chain 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zanii-chain 0.1.0
File Size Uploaded
zanii_chain-0.1.0.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zanii-chain 0.1.0
File Interpreter ABI Platform
zanii_chain-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.5 kB

Release files / zanii_chain-0.1.0.tar.gz

Download URL zanii_chain-0.1.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7a9cc55e039d42ce9de39072a91455c8fc23aeb83ba014a5a2b87eae24e4643c
BLAKE2b-256 checksum
How to use checksums
6ce45b1aa575a1567af868da2bc922f4595e469b67135d9d15ef934ed87fc6ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / zanii_chain-0.1.0-py3-none-any.whl

Download URL zanii_chain-0.1.0-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab941e423396a08020f7cce0f5ba7cd596c862a331020ab0d2bf3803433ed2ea
BLAKE2b-256 checksum
How to use checksums
ac2df64c15d269a2998c98b2c9596acb0dec1d06ddceb52559a8d841f556d2eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page