Skip to main content

No project description provided

Project description

Axiomatic Verifier (Python) is the SDK for independently verifying on-chain p1 attestations (and related formats) published on Algorand.

Given a transaction ID, it:

  1. Fetches the transaction via an Algorand Indexer.
  2. Extracts and parses the note.
  3. Re-canonicalizes the JSON (JCS/ACJ-style).
  4. Recomputes the SHA-256.
  5. Applies lightweight rules (schema, hash, timestamp).
  6. Returns a structured JSON-style result.

No dependency on Axiomatic backend: anyone can verify.


Installation

Requires Python 3.10+.

pip install axiomatic_verifier

(requests is installed automatically as a dependency.)


Exposed API

From axiomatic_verifier:

  • verify_tx(txid, network="testnet", indexer_url=None, max_skew_past_sec=..., max_skew_future_sec=...)

Utility helpers:

  • to_jcs_bytes(obj)
  • sha256_hex(b)

Quickstart: verify a p1 transaction

This example mirrors the internal smoke test and is suitable as a public snippet.

1. Environment (optional)

Create a .env file next to your script (optional):

ALGORAND_NETWORK=testnet
# INDEXER_URL=https://testnet-idx.algonode.cloud

If INDEXER_URL is not set, the SDK will default to Algonode (https://mainnet-idx.algonode.cloud or https://testnet-idx.algonode.cloud).

2. Example script (verify_tx_example.py)

import os
import sys
import json
from pathlib import Path

from axiomatic_verifier import verify_tx

ROOT = Path(__file__).resolve().parent


def load_env(env_path: Path) -> None:
    try:
        for line in env_path.read_text(encoding="utf-8").splitlines():
            if not line or line.strip().startswith("#") or "=" not in line:
                continue
            k, v = line.split("=", 1)
            k, v = k.strip(), v.strip()
            if k and (k not in os.environ):
                os.environ[k] = v
    except FileNotFoundError:
        pass


load_env(ROOT / ".env")


def main() -> None:
    if len(sys.argv) < 2:
        print("Usage:", file=sys.stderr)
        print("  python verify_tx_example.py <TXID>", file=sys.stderr)
        sys.exit(1)

    txid = sys.argv[1].strip()
    network = (os.getenv("ALGORAND_NETWORK") or "testnet").strip()

    # Default Indexer: Algonode (can be overridden via INDEXER_URL)
    indexer_url = (
        os.getenv("INDEXER_URL")
        or (
            "https://mainnet-idx.algonode.cloud"
            if network == "mainnet"
            else "https://testnet-idx.algonode.cloud"
        )
    ).strip()

    res = verify_tx(
        txid=txid,
        network=network,
        indexer_url=indexer_url,
        # For examples: accept p1 issued within the last hour
        max_skew_past_sec=3600,
        max_skew_future_sec=300,
    )

    print(json.dumps(res, indent=2, ensure_ascii=False))


if __name__ == "__main__":
    main()

Run:

python verify_tx_example.py <TXID>

Use a txid produced by axiomatic_proofkit on the same network.


Response model

verify_tx always returns a dict-like structure. Typical shapes:

Valid p1

{
  "txid": "...",
  "verified": true,
  "mode": "p1",
  "reason": null,
  "note_sha256": "...",
  "rebuilt_sha256": "...",
  "confirmed_round": 57318625,
  "explorer_url": "https://testnet.explorer.perawallet.app/tx/...",
  "note": {
    "s": "p1",
    "a": "re:EUR",
    "mv": "v2",
    "mh": "",
    "ih": "...",
    "v": 550000.0,
    "u": [520000.0, 580000.0],
    "ts": 1762609210
  }
}

Stale / out-of-window p1

{
  "txid": "...",
  "verified": false,
  "mode": "p1",
  "reason": "ts_out_of_window",
  "note_sha256": "...",
  "rebuilt_sha256": "...",
  "explorer_url": "..."
}

Meaning: structurally and cryptographically correct p1, but ts is outside the allowed time window (max_skew_past_sec / max_skew_future_sec).

Unsupported / missing note

{
  "txid": "...",
  "verified": false,
  "mode": "unknown",
  "reason": "unsupported_or_empty_note",
  "explorer_url": "..."
}

Canonical JSON helpers (optional)

You can use the bundled JCS/ACJ-style helpers for your own golden tests:

from axiomatic_verifier import to_jcs_bytes, sha256_hex
import json

obj = json.loads(open("p1.json", "r", encoding="utf-8").read())
b = to_jcs_bytes(obj)
print(sha256_hex(b))

This lets you confirm that your own tooling matches the canonicalization used on-chain.


This is an early-access verifier: please treat responses as structured signals to plug into your own risk/validation logic.

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

axiomatic_verifier-0.1.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

axiomatic_verifier-0.1.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: axiomatic_verifier-0.1.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for axiomatic_verifier-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7a6172ea6a0e8de3b97d7be1ae62d43e325bc6519626c4d12f3a8102b869775b
MD5 2aa7a9b79b4da2b6475b687a72dfc4ea
BLAKE2b-256 1bbe3f5a900400fdcd83dcd03a0a1ff6f9a2c027e7a8d81b6f5a40b5936d863e

See more details on using hashes here.

File details

Details for the file axiomatic_verifier-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for axiomatic_verifier-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a2f0551207310f4682d4ffb02cfbcfc141e2e6fed2b6f73aa3c6b29b53179a22
MD5 8fc2ed6ed72eb6753106fb03fe671114
BLAKE2b-256 96648317d0c78926dac1309c3c8813ae0e76502dca88a7823f07bcb89b5f476a

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