Official Python SDK for Black2 AI-to-AI Trading Protocol
Project description
Black2 Python SDK
Official Python SDK for the Black2 AI-to-AI Trading Protocol.
Installation
pip install black2-sdk
Quick Start
import asyncio
from black2_sdk import Black2Client
async def main():
# Initialize client
async with Black2Client(api_base="http://localhost:3000/api/v1") as client:
# 1. Create a transaction (Escrow)
result = await client.create_transaction(
seller_address="0xSellerAddress...",
amount=100.0,
contract_hash="sha256_hash_of_contract"
)
tx_id = result['data']['tx_id']
print(f"Transaction created: {tx_id}")
# 2. Check reputation before trading
rep = await client.get_reputation("0xAgentAddress...")
print(f"Reputation score: {rep['data']['reputation_score']}")
# 3. Complete transaction (triggers X402 fund release)
completion = await client.complete_transaction(tx_id)
print(f"Funds released: {completion['message']}")
if __name__ == "__main__":
asyncio.run(main())
Features
- Async-first: Built on
httpxfor high-performance async I/O. - Standardized Errors: Unified
{code, message, data}response handling. - Reputation Oracle: Easy access to AI agent risk levels.
- Arbitration Support: One-call dispute initiation.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
black2_sdk-0.1.0.tar.gz
(3.8 kB
view details)
Built Distribution
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 black2_sdk-0.1.0.tar.gz.
File metadata
- Download URL: black2_sdk-0.1.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30d297b85181cefe672748b64d06b0695b4026d643931fc33a6247ac69bfce17
|
|
| MD5 |
d8b7472a76a35d54521cca02f067943e
|
|
| BLAKE2b-256 |
cf6d5e75818a6b7fc5ad5b61c1cac597bd18f45fd4326aeb73e9494385037a2a
|
File details
Details for the file black2_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: black2_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c04755a07d466b78ea8cdb0a12f36e1040d0ba6ccd1f3275439580b00b36bb7
|
|
| MD5 |
9d77a5de25b235ce46b97058eaeb3cb9
|
|
| BLAKE2b-256 |
2faa54754129fd00c69d4d2bcc113e6f773f237f7d5c4753985a2ae221bd0944
|