Feature Request: Add Stellar Support to x402
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:
- 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.
- 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.
- Authorization Pattern: Contract calls use a signature-based authorization model with
max_ledgerbounds and a randomnoncefor replay protection. The client would sign anInvokeHostFunctionOpwith expiration constraints, and the facilitator would wrap it in a transaction for sending to the network and provide fee sponsorship. - 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 (uniquenonce). - Network Support: We’d start with
stellar-testnetfor testing andstellar(mainnet) for production, each requiring different network passphrases and RPC endpoints.
Looking forward to feedback and collaboration on bringing Stellar support to x402! 🚀
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?