Skip to main content

Python SDK for interacting with the Zenon network and ecosystem.

Project description

znn-sdk

Python 3.12+ SDK for the Zenon Network of Momentum protocol. Version 0.1 follows the stable language-neutral SDK specification and canonical go-zenon wire behavior. Distributed on PyPI as znn-sdk; the import name is znn.

Install

python3.12 -m pip install znn-sdk

No public third-party node is selected automatically. Pass an explicit HTTP(S) or WebSocket endpoint when initializing the high-level SDK:

from znn import Zenon

sdk = Zenon()
await sdk.initialize("wss://your-node.example:35998")
await sdk.disconnect()

Transactions

Block preparation is separate from publication. Preparation reads the account and momentum frontiers, applies fused plasma or PoW, hashes the canonical preimage, and signs the raw 32-byte hash with Ed25519.

from znn.model.nom.account_block import AccountBlock
from znn.model.primitives.address import Address
from znn.model.primitives.token_standard import ZNN_ZTS
from znn.wallet.transact import Transact

block = AccountBlock.send(Address.parse("z1..."), ZNN_ZTS, 100_000_000)
tx = Transact(private_key_hex, ledger_api, plasma_api)
prepared = await tx.prepare_block(block)
published = await tx.publish_block(prepared)

Transact.send, receive, and call_contract provide combined convenience flows. The lower-level split is recommended for signing review, hardware-wallet integration, and deterministic offline tests.

Capabilities

  • strict Address, Hash, TokenStandard, and HashHeight primitives;
  • arbitrary-precision decimal-string wire amounts;
  • all 72 field-aware wire models and 6 enums, with typed RPC results;
  • all 76 canonical positional JSON-RPC calls;
  • all 84 embedded ABI functions and 68 corrected builders;
  • strict ABI integer, boolean, fixed-byte, and custom-array behavior;
  • persistent WebSocket and HTTP JSON-RPC transports with structured errors;
  • normalized subscriptions with reconnect/resubscribe support;
  • BIP39/SLIP-0010 wallets and Ed25519 signing;
  • Argon2id/AES-256-GCM key files;
  • exact amount conversion and Zenon PoW generation/verification.

The removed embedded.plasma.getRequiredFusionAmount method remains only as a deprecated compatibility stub and raises NotImplementedError.

Conformance and tests

Run the unit suite:

python3.12 -m pytest -q

Measure the enforced offline branch coverage (the stable spec checkout supplies vectors and a localhost fixture, not a Zenon node):

ZNN_SPEC_ROOT=/path/to/zenon-sdk-spec \
  python3.12 -m coverage run -m pytest -q
python3.12 -m coverage report

CI requires at least 95% branch-enabled combined coverage across the complete znn package.

Run all 764 stable vectors and validate the portable result document:

python3.12 -m znn.conformance \
  /path/to/zenon-sdk-spec/conformance/vectors \
  --output znn-sdk-results.json
python3 /path/to/zenon-sdk-spec/tools/znn_spec.py \
  check-results znn-sdk-results.json

All conformance tests are deterministic and offline; no live node is required. The transport cases use the specification's localhost fixture and exercise the real HTTP/WebSocket clients, including reconnect and resubscription.

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

znn_sdk-0.1.2.tar.gz (63.9 kB view details)

Uploaded Source

Built Distribution

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

znn_sdk-0.1.2-py3-none-any.whl (64.1 kB view details)

Uploaded Python 3

File details

Details for the file znn_sdk-0.1.2.tar.gz.

File metadata

  • Download URL: znn_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 63.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for znn_sdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5eb62c4cd87c2dfb4238d83aaf8eff95c48edf0201e529b653209c1c5d0338b6
MD5 96ed2f08a534ed0e022f12c428b43f65
BLAKE2b-256 65406fe845ba089acace108bfeb773af9104b1d864e082514d0b742eaae6b681

See more details on using hashes here.

Provenance

The following attestation bundles were made for znn_sdk-0.1.2.tar.gz:

Publisher: publish.yml on 0x3639/znn-sdk-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file znn_sdk-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: znn_sdk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 64.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for znn_sdk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 17883befd4499fa318e4c35e6bf63dc9182743ac2f329ffc983d0d24429fe0cd
MD5 ce84890e8cfd5999b11ed18152dc681d
BLAKE2b-256 a092fc202997c765c9b8fef2510f3a9f96cf3454f8b4e72754d0f90f1c965937

See more details on using hashes here.

Provenance

The following attestation bundles were made for znn_sdk-0.1.2-py3-none-any.whl:

Publisher: publish.yml on 0x3639/znn-sdk-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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