Skip to main content

x402-algorand

Algorand AVM extensions for the x402 payment protocol.

This package is a fork of GoPlausible/x402-avm (v2.0.2) customized for seamless native ALGO settlement and private node / LocalNet integration.

Key Changes in this Fork

  1. Native ALGO Payments (asset == 0):

    • mechanisms/avm/exact/client.py: Builds native PaymentTxn (type pay) instead of AssetTransferTxn (axfer) when requirements.asset == "0" or 0.
    • mechanisms/avm/exact/facilitator.py: verify() checks for TXN_TYPE_PAYMENT, verifies receiver payment_txn.receiver == requirements.pay_to, and verifies payment_txn.amount == requirements.amount. For asset != 0, standard ASA transfer verification applies.
  2. Custom Algod Token Support:

    • Added algod_token parameter to ExactAvmScheme client and register_exact_avm_client.
    • Enables direct authentication with local nodes, such as AlgoKit LocalNet (X-Algo-API-Token: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa).
  3. CAIP-2 Network Resolution & Private Nodes:

    • mechanisms/avm/utils.py: Known networks (MainNet, TestNet, FNet) are mapped via NETWORK_CONFIGS. Any custom or LocalNet CAIP-2 network (algorand:<genesis_hash>) is accepted by normalize_network without requiring a static table entry, and get_genesis_hash dynamically parses the genesis hash from the CAIP-2 string.
    • When configured with a custom algod_url / algod_token, clients and facilitators interact directly with private or LocalNet nodes for arbitrary genesis hashes.

Installation

pip install -e .

Running Tests

The test suite includes offline unit tests with mocked Algod/signers as well as integration tests on a live Algorand LocalNet network.

Offline Unit Tests

Does not require a running node or network connection:

python -m pytest tests -q

(Runs unit tests in tests/test_avm_fork.py; skips LocalNet tests)

LocalNet Integration Tests

Requires AlgoKit LocalNet running and accounts bootstrapped in chain/accounts.json:

LOCALNET=1 python -m pytest tests -q

(Runs all unit tests plus tests/test_localnet_algo_payment.py, testing end-to-end payment creation, verification, and on-chain settlement)

Metadata

Release files for x402-algorand 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for x402-algorand 0.1.3
File Size Uploaded Provenance Actions
x402_algorand-0.1.3.tar.gz 1.6 MB Without provenance Details for x402_algorand-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for x402-algorand 0.1.3
File Interpreter ABI Platform Actions
x402_algorand-0.1.3-py3-none-any.whl Python 3 none any Details for x402_algorand-0.1.3-py3-none-any.whl

Total release size: 3.2 MB

Release files / x402_algorand-0.1.3.tar.gz

Download URL x402_algorand-0.1.3.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
d1778864483360c13ed8f3eaefd0de029ef8ee3a165a43ca53fca4d6daec1ced
BLAKE2b-256 checksum
How to use checksums
64d3568e07857b27270992ac984360f4e705e64339fba02ed4452ee800598dc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / x402_algorand-0.1.3-py3-none-any.whl

Download URL x402_algorand-0.1.3-py3-none-any.whl
Size 1.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
e8dabccf06efaa2dadd16e60abce9a8f121f71e1ca4f7856bcdecadfb303420f
BLAKE2b-256 checksum
How to use checksums
104214c456834db816f3d24fc74161d8cde08fce2a66aa2e84a219764729a225
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for x402-algorand 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page