x402 icon indicating copy to clipboard operation
x402 copied to clipboard

Feature Request: Add Stellar Support to x402

Open sagpatil opened this issue 2 months ago • 1 comments

We (@stellar) would like to contribute support for Stellar to x402.

We're comfortable following guidelines in CONTRIBUTING.md as well as the v1 Protocol spec, and we expect Stellar support to comply with existing (and upcoming) schemes.

We’d start by implementing support for the exact scheme using Stellar smart contracts (Soroban) with tokens that conform to the SEP-41 token standard. We welcome feedback and collaboration on the implementation design specifics as we move forward.

A couple considerations to kick off the conversation:

  1. Asset Support: Stellar has built-in assets, and contract assets, both of which implement the SEP-41 Token Standard. We’d propose supporting both through the SEP-41 interface. Stellar has two ways to execute transfers, through a classic interface and through contract calls using the SEP-41 interface. We propose using the latter as it supports a larger variety of tokens.
  2. Fee Sponsorship: The current x402 implementation suggests gasless transactions. For Stellar, we propose using fee bump transactions, where the facilitator sponsors the network fee (similar to how EVM uses meta-transactions). This allows clients to send only an authorization signature without having to hold XLM for fees.
    • ⏳Alternate sponsorship models could be explored later.
  3. Authorization Pattern: Contract calls use a signature-based authorization model with max_ledger bounds and a random nonce for replay protection. The client would sign an InvokeHostFunctionOp with expiration constraints, and the facilitator would wrap it in a transaction for sending to the network and provide fee sponsorship.
  4. Verification: The facilitator would verify the transaction encoded by the client to ensure that the correct token contract is being invoked with the expected parameters (amount, source, and destination), and would simulate it with the provided signature to ensure correct authorization, validity (max_ledger), and anti-replay protection (unique nonce).
  5. Network Support: We’d start with stellar-testnet for testing and stellar (mainnet) for production, each requiring different network passphrases and RPC endpoints.

Looking forward to feedback and collaboration on bringing Stellar support to x402! 🚀

sagpatil avatar Nov 11 '25 18:11 sagpatil

Hey @CarsonRoscoe, I'm seeing a lot of activity on the v2-development branch. Should new PRs be based on that branch, or is main still the correct starting point for contributions?

marcelosalloum avatar Nov 13 '25 00:11 marcelosalloum