Skip to content

Conversation

@emg110
Copy link

@emg110 emg110 commented Sep 23, 2025

Add Algorand (AVM) Support to x402 Protocol (Spec & TS)

Description

This PR adds comprehensive support for the Algorand Virtual Machine (AVM) to the x402 protocol, enabling payment verification and settlement on Algorand networks (both mainnet and testnet). The implementation follows the exact scheme pattern established for EVM and SVM networks, providing a consistent developer experience across all supported blockchains.

Check it live, set to receive 0.01 USDC with paid fees on Algorand TESTNET, here: X402-Algorand

Key additions and modifications include:

  • AVM Client Implementation: Added client-side functionality for creating and signing Algorand transactions, including support for both native ALGO and ASA (Algorand Standard Asset) payments.
  • AVM Facilitator: Implemented verification and settlement logic for Algorand transactions, with support for fee delegation
  • Wallet Integration: Added use-wallet for universal Algorand wallets support.
  • Middleware Support: Extended the x402-next middleware to handle Algorand payment requirements
  • Paywall UI: Enhanced the PaywallApp component to support Algorand payments and asset transfers
  • Site: Added Algorand networks support to site.
  • Type Definitions: Added comprehensive type definitions for Algorand-specific components
  • Documentation: Added JSDoc comments to all new functions and updated existing documentation

This implementation enables developers to easily integrate Algorand payments into their applications using the same familiar x402 API patterns used for other blockchains.

Features

  • Delivers both payment with Algo or Assets
  • Uses Lease field for PaymentRequirement attestation.
  • Delivers configurable fee delegation (by feePayer config).
  • Handles settlement and succeeds on Transaction finality thanks to Algorand's under 3 seconds transaction finality.

Tests

All tests have passed
Screenshot 2025-09-23 at 02 47 03

All lints are checked and passed:

Screenshot 2025-09-23 at 03 03 45

Checklist

  • I have formatted and linted my code
  • All new and existing tests pass
  • My commits are signed by @emg110

Author

Contributed by @emg110 from @GoPlausible

Future roadmap

  • Comprehensive contributions to x402 MCP
  • Comprehensive contributions to x402 A2A
  • Comprehensive contributions to x402 AP2

The env format

NEXT_PUBLIC_FACILITATOR_URL=http://localhost:3000/facilitator
RESOURCE_WALLET_ADDRESS=MPY54CLPH2OKEGC6S5N2LDAFDNO5BVNV532NBZ5VD6GOND3STPNXZYXOFE
NETWORK=algorand-testnet
PRIVATE_KEY= ALGORAND MNEMONIC
ASSET=10458941
PRICE=0.01
ALGOD_SERVER=https://testnet-api.algonode.cloud
ALGOD_TOKEN=
ALGOD_PORT=
ALGORAND_FEE_PAYER=MPY54CLPH2OKEGC6S5N2LDAFDNO5BVNV532NBZ5VD6GOND3STPNXZYXOFE
goPlausible-logo Screenshot 2025-09-23 at 02 05 31 Screenshot 2025-09-23 at 02 05 09 Screenshot 2025-09-23 at 02 02 14

@vercel
Copy link

vercel bot commented Sep 23, 2025

@emg110 is attempting to deploy a commit to the Coinbase Team on Vercel.

A member of the Team first needs to authorize it.

@cb-heimdall
Copy link

cb-heimdall commented Sep 23, 2025

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@emg110
Copy link
Author

emg110 commented Sep 23, 2025

Appreciations in advance for your time to review this PR. I also have a question:
Where is best to add the comprehensive documentation for Algorand developers and end users and also supported ENV variables for AVM developers in README files in the project structure or perhaps in root README in a section. Thanks for your help.

@emg110
Copy link
Author

emg110 commented Oct 19, 2025

Hello Coinbase team,

It has been a while and I have many new contributions on A2A and AP2 integrations for x402 that are waiting on this one to be merged.

The temporary (before merge of this) avm supporting NPM packages x402-avm, x402-avm-fetch,... are published to NPM and are in work in some implementations. Many examples on each x402 MCP, A2A and AP2 integrations with ref implementations are ready to go as a PR. These are the first of their kinds so timing would be of vital importance in Agentic era.

One of the exciting new things coming up is dynamic x402 payments implementation and examples, usable for shopping flow scenarios where the resources are dynamic and based on Shopper intents and cart. This is available in MCP and A2A implementations.

On top of that with x402-AP2 integration all that will be identifiable, verifiable and with provenance.

Let's Go and make that being 10x better happen together

@originalGSD
Copy link

Coinbase Team,

Can this be reviewed and merged? Our project is currently on hold because of this. Thanks!

@emg110
Copy link
Author

emg110 commented Nov 5, 2025

This PR gets closed by Author in favor and support of Algorand Foundation proposal . AF and GoPlausible have joined efforts and collaborations on X402 development. The reference implementation and examples codes will be adopted and added to that PR as well. This closed PR will still be preserved as a backup, just in case of alternative approach requirement.

@emg110 emg110 closed this Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants