Skip to main content

baud-sdk

Python SDK for the Baud M2M Agent Ledger.

Installation

pip install baud-sdk

This installs everything needed — no external binaries required.

Quick Start

from baud_sdk import BaudClient, NativeKeyPair, QUANTA_PER_BAUD

# Generate a new agent identity (pure Python, no CLI needed)
kp = NativeKeyPair.generate()
print(f"Address: {kp.address_hex}")
print(f"Secret:  {kp.secret_hex}")

# Connect to a node with pure Python signing
client = BaudClient.from_secret(kp.secret_hex, node_url="http://localhost:8080")

# Send 1 BAUD
result = client.native_send(to="<recipient-address>", amount=QUANTA_PER_BAUD)
print(f"TX hash: {result['tx_hash']}")

# Check balance
balance = client.balance(kp.address_hex)
print(f"Balance: {balance} quanta = {balance / QUANTA_PER_BAUD} BAUD")

# Create escrow
client.native_create_escrow(
    recipient="<worker-address>",
    amount=500 * QUANTA_PER_BAUD,
    preimage="proof_of_delivery",
    deadline=1700000000000,
)

# Register agent identity
client.native_register_agent(
    name="my-agent",
    endpoint="https://api.myagent.ai",
    capabilities=["llm", "inference"],
)

For AI Agents

An AI agent only needs to run pip install baud-sdk — no Rust, no compiling, no CLI binary.

from baud_sdk import BaudClient

# Agent connects with its secret key
client = BaudClient.from_secret("your_secret_key_hex", node_url="http://node-ip:8080")

# Pay for a service
client.native_send(to="service_provider_address", amount=10**18, memo="image-gen-job-42")

# Check balance
client.balance(client.address)

API Reference

NativeKeyPair (recommended — pure Python)

  • NativeKeyPair.generate() — Generate a new random keypair
  • NativeKeyPair.from_secret_hex(hex) — Restore from a hex secret key
  • .address_hex — Hex-encoded agent address
  • .secret_hex — Hex-encoded secret key
  • .sign(message) — Sign raw bytes

BaudClient

Create:

  • BaudClient.from_secret(secret_hex, node_url, chain_id) — Pure Python client (recommended)
  • BaudClient(node_url, keypair=kp) — CLI-based client (legacy)

Query methods:

  • client.status() — Node status
  • client.account(address) — Account details
  • client.balance(address) — Balance in quanta
  • client.nonce(address) — Current nonce
  • client.get_escrow(id) — Escrow details
  • client.get_tx(hash) — Transaction lookup
  • client.mempool() — Pending transactions

Native signing methods (pure Python, recommended):

  • client.native_send(to, amount, memo=None, nonce=None)
  • client.native_create_escrow(recipient, amount, preimage, deadline, nonce=None)
  • client.native_release_escrow(escrow_id, preimage, nonce=None)
  • client.native_refund_escrow(escrow_id, nonce=None)
  • client.native_register_agent(name, endpoint, capabilities, nonce=None)

CLI-based methods (requires baud binary, legacy):

  • client.send(to, amount, memo=None, nonce=None)
  • client.create_escrow(recipient, amount, preimage, deadline, nonce=None)
  • client.release_escrow(escrow_id, preimage, nonce=None)
  • client.refund_escrow(escrow_id, nonce=None)
  • client.register_agent(name, endpoint, capabilities, nonce=None)

Constants

  • QUANTA_PER_BAUD = 10**18

Metadata

Release files for baud-sdk 0.2.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 baud-sdk 0.2.0
File Size Uploaded
baud_sdk-0.2.0.tar.gz 11.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for baud-sdk 0.2.0
File Interpreter ABI Platform
baud_sdk-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.1 kB

Release files / baud_sdk-0.2.0.tar.gz

Download URL baud_sdk-0.2.0.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c79ddf42bc3b90cf2fb6c02b0b77fef06b8f32853607640c9d908b8563c6472c
BLAKE2b-256 checksum
How to use checksums
c6989e51fea4fbb37f0f61abe1da5f91d8d34308ef2b4d7f8e35ace0176a412a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / baud_sdk-0.2.0-py3-none-any.whl

Download URL baud_sdk-0.2.0-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
015f7c97dd180ff06d94bf0c0ffb5ef87d24bb402dc4a37884f84ae29882b28d
BLAKE2b-256 checksum
How to use checksums
bfbbed73b6c7d997b288749a348d5a259b8a0b05383d6780c39aaf606e584a66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.2.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