x402-algorand
Algorand AVM extensions for the x402 payment protocol.
Import name: x402. This conflicts with the separate x402 package on PyPI, so do not install both in one environment.
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
-
Native ALGO Payments (
asset == 0):mechanisms/avm/exact/client.py: Builds nativePaymentTxn(typepay) instead ofAssetTransferTxn(axfer) whenrequirements.asset == "0"or0.mechanisms/avm/exact/facilitator.py:verify()checks forTXN_TYPE_PAYMENT, verifies receiverpayment_txn.receiver == requirements.pay_to, and verifiespayment_txn.amount == requirements.amount. Forasset != 0, standard ASA transfer verification applies.
-
Custom Algod Token Support:
- Added
algod_tokenparameter toExactAvmSchemeclient andregister_exact_avm_client. - Enables direct authentication with local nodes, such as AlgoKit LocalNet (
X-Algo-API-Token: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa).
- Added
-
CAIP-2 Network Resolution & Private Nodes:
mechanisms/avm/utils.py: Known networks (MainNet, TestNet, FNet) are mapped viaNETWORK_CONFIGS. Any custom or LocalNet CAIP-2 network (algorand:<genesis_hash>) is accepted bynormalize_networkwithout requiring a static table entry, andget_genesis_hashdynamically 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)
License
Apache License 2.0, the same licence as the projects it is derived from: GoPlausible/x402-avm
and coinbase/x402. See LICENSE, and NOTICE for the attributions and the list of
files changed from x402-avm 2.0.2. Earlier releases of this package (0.1.0 to 0.1.3) were labelled MIT by mistake;
from 0.1.4 on it is Apache-2.0.
Metadata
Release files for x402-algorand 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| x402_algorand-0.1.4.tar.gz | 1.6 MB | Without provenance | Details for x402_algorand-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| x402_algorand-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for x402_algorand-0.1.4-py3-none-any.whl |
Total release size: 3.2 MB
Release files / x402_algorand-0.1.4.tar.gz
| Download URL | x402_algorand-0.1.4.tar.gz |
|---|---|
| Size | 1.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc0947908a8bb37f61b9ed2343ac5b10ee7c559cebe37b06d4c1133b44fe6f5c
|
|
BLAKE2b-256 checksum How to use checksums |
cf75a554624c5b77a82d7f50e8758bfc996296405b03ee5f1d5260bd63a84a98
|
| 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.4-py3-none-any.whl
| Download URL | x402_algorand-0.1.4-py3-none-any.whl |
|---|---|
| Size | 1.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9049ab2e726ff35e2e18396d15f8d87aa4006348f6a8e95f05109f1b7b68928a
|
|
BLAKE2b-256 checksum How to use checksums |
dd7436a81ef0a46627695c35070355b96a6dc50ed9fa740ede2f5e1f4f60e613
|
| 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.4
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.