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.1.tar.gz (59.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.1-py3-none-any.whl (62.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for znn_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4cda2dd94ff0151b3532493676fdb71fd91966e96285b015cb94f833113736d2
MD5 653c232ac16f535c8f7954816f6ab2a6
BLAKE2b-256 ba6fb064f77b5c9eaffe030e3cefb21a13f1329aa334539cddd202a7b0f1904b

See more details on using hashes here.

Provenance

The following attestation bundles were made for znn_sdk-0.1.1.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.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for znn_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a024d3441197076e4d5e61b1dedaeb606c59c62e8e3501ca3ac32098a912bfe
MD5 f9bcbb0d04ab7156d2b5d5ff68041dce
BLAKE2b-256 55bc123607c589ea70f1c2a4c271b7fa70aaf52a55e1c2d81a17f9d01aa79588

See more details on using hashes here.

Provenance

The following attestation bundles were made for znn_sdk-0.1.1-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