Skip to main content

Official Python SDK for OmbraChain — REST/WS/SSE client, wallet, tx builders, encrypted storage

Project description

ombrachain

Official Python SDK for OmbraChain — Proof of AI Tokens Used blockchain with native AI compute pool.

PyPI Python License: MIT

  • REST clients for all mainnet endpoints
  • Wallet (BIP39 + HD m/44'/7777'/0'/0/* + Ed25519)
  • All 11 tx builders with bit-exact-match signatures cu TS SDK
  • EncryptedStorage (AES-256-GCM + PBKDF2 100k iter)
  • Async WebSocket + SSE streaming

Install

pip install ombrachain

Quick start

Check balance

from ombrachain import OmbraClient

client = OmbraClient("https://api.ombra-net.com")
account = client.chain.get_account("5bb5c50f185363cf913f93a18c6837c20d720a69")
print(f"balance: {account['balance']} micro-OMBRA, nonce: {account['nonce']}")

Create wallet + send OMBRA

from ombrachain import OmbraClient, Wallet

client = OmbraClient("https://api.ombra-net.com")

wallet = Wallet.generate()          # new BIP39 12-word
print("address:", wallet.address)
print("mnemonic (BACKUP!):", wallet.mnemonic)

# SAU
wallet = Wallet.from_mnemonic("twelve word mnemonic ...")

result = client.send(wallet, to="abc...", amount=1_000_000, fee=10_000)
print("tx hash:", result["hash"])

Submit AI task

result = client.submit_task(
    wallet,
    prompt="Explain Proof of AI Tokens Used in 100 words",
    task_type="chat",
    fee=500_000,
)
print("task ID:", result["task_id"])

# Poll for result
import time
while True:
    task = client.tasks.get_detailed(result["task_id"])
    if task["status"] in ("completed", "failed"):
        break
    time.sleep(5)
print("result:", task.get("result"))

Subscribe to new blocks (async)

import asyncio
from ombrachain import OmbraClient

async def main():
    client = OmbraClient("https://api.ombra-net.com")
    async with client.subscribe_chain() as sub:
        async for evt in sub:
            if evt["type"] == "block":
                print("new block:", evt["block"]["index"])

asyncio.run(main())

Encrypted wallet storage

from ombrachain import Wallet, EncryptedStorage

storage = EncryptedStorage("wallet.enc")

wallet = Wallet.generate()
storage.save(wallet, "user-password-123")

# Later
loaded = storage.load("user-password-123")
print(loaded.address)

Cross-language compatibility

Tx-uri semnate cu acest SDK sunt bit-exact identice cu cele semnate cu @ombrachain/sdk (TypeScript). Vector tests în tests/test_cross_language.py validează roundtrip TS ↔ Python pe mnemonic-uri și payload-uri fixe.

License

MIT © OmbraChain

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ombrachain-0.1.0.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ombrachain-0.1.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file ombrachain-0.1.0.tar.gz.

File metadata

  • Download URL: ombrachain-0.1.0.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for ombrachain-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fd85deab0033f76600a8d4323e7a7b3e7ab08ad200afa7d69428ab074673b8fc
MD5 7f98ad45bf830b9b46dd541d817811dd
BLAKE2b-256 321a7a5f3858cff499b946ca52ae9ea344c757b605806157c3169a8ae15dae18

See more details on using hashes here.

File details

Details for the file ombrachain-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ombrachain-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for ombrachain-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc66b08c65ca037b186a84e96344dd63e306928a2c9d88907ee26dfc8a881f01
MD5 41c16257858b7136a9ecf325e835a1e7
BLAKE2b-256 602303add4a33c6797b995aed7757f38e01659798734fb02010682dfabc19ab7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page