-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Giant dump of info:
About Stacks
- Bitcoin L2 with 100% Bitcoin finality for smart contracts and DeFi
- Proof of Transfer (PoX) consensus anchored to Bitcoin's security
- Fast blocks (~5 seconds) with multiple Stacks blocks per Bitcoin block
- Clarity smart contracts with native Bitcoin state visibility
- sBTC for decentralized, programmable BTC; STX for gas
- Stacks Website | sBTC | Docs
x402 Ecosystem Entries
| Entry | Category | Description |
|---|---|---|
| x402Stacks | Client-Side Integrations | TypeScript SDK (x402-stacks on npm) |
| x402Stacks Facilitator | Facilitators | Transaction settlement service |
| x402StacksScan | Infrastructure & Tooling | Ecosystem explorer and stats |
| AIBTC Sponsor Relay | Infrastructure & Tooling | Sponsored / gasless transaction relay |
| STX402 | Endpoints | x402 powered registry (mainnet) |
| AIBTC x402 API | Endpoints | AI inference and app storage (mainnet + testnet) |
| x402 Biwas | Endpoints | AI-powered DeFi analytics |
x402 Supported Tokens
| Token | Mainnet | Testnet |
|---|---|---|
| STX | Native | Native |
| sBTC | SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token::sbtc-token |
ST1F7QA2MDF17S807EPA36TSS8AMEFY4KA9TVGWXT.sbtc-token::sbtc-token |
| USDCx | SP120SBRBQJ00MCWS7TM5R8WJNTTKD5K0HFRC2CNE.usdcx::usdcx-token |
Not yet deployed |
Link Dump
Protocol / facilitator:
- x402 on Stacks website: https://stacksx402.com
- mainnet/testnet: https://facilitator.stacksx402.com
- health check: https://facilitator.stacksx402.com/health
- explorer/scan: https://scan.stacksx402.com
- github org: https://github.com/x402Stacks
- facilitator: https://github.com/x402Stacks/x402-stacks-facilitator
- SDK: https://github.com/tony1908/x402-stacks-sdk
Sponsored / gasless TX relay:
- github: https://github.com/aibtcdev/x402-sponsor-relay
- mainnet: https://x402-relay.aibtc.com
- mainnet docs: https://x402-relay.aibtc.com/docs
- testnet: https://x402-relay.aibtc.dev
- testnet docs: https://x402-relay.aibtc.dev/docs
stx402 endpoints:
- github: https://github.com/whoabuddy/stx402
- mainnet endpoints: https://stx402.com
- mainnet docs: https://stx402.com/docs
- mainnet dashboard: https://stx402.com/dashboard
AIBTC endpoints:
- github: https://github.com/aibtcdev/x402-api
- one-pager: docs: add one-pager explaining x402 API value proposition x402-api#22
- mainnet endpoints: https://x402.aibtc.com
- mainnet docs: https://x402.aibtc.com/docs
- mainnet dashboard: https://x402.aibtc.com/dashboard
- testnet endpoints: https://x402.aibtc.dev
- testnet docs: https://x402.aibtc.dev/docs
- testnet dashboard: https://x402.aibtc.dev/dashboard
Biwas endpoints:
- github: https://github.com/biwasxyz/x402
- mainnet endpoints: https://x402.biwas.xyz
First Integration Issue Details
Overview
Add Stacks as a third supported blockchain alongside EVM and Solana. The settlement model mirrors Solana (pre-signed transaction broadcast, not EVM-style authorization), making it a natural fit for the existing architecture. This brings three new payment tokens: STX, sBTC, and USDCx.
There's an existing Stacks x402 facilitator written in Go (x402-stacks-facilitator) and a TypeScript client/server library (x402-stacks). The goal here is to implement Stacks settlement natively in TypeScript within OpenFacilitator's core, following the same pattern as the existing EVM and Solana modules. A working crosschain example demonstrates EVM + Stacks in a single app using the x402 v2 protocol.
Stacks Settlement Model
| Aspect | Detail |
|---|---|
| Settlement | Pre-signed transaction broadcast via Hiro API |
| Verification | Deferred to settlement — poll Hiro API for tx confirmation |
| Key format | Hex (secp256k1, via @stacks/transactions) |
| Address format | Principal — SP…/SM… (mainnet), ST…/SN… (testnet) |
| Token standard | SIP-010 fungible tokens (transfer contract call) |
| Fee payer | Sender pays by default — co-signing supported for sponsored transactions (see x402-sponsor-relay) |
| CAIP-2 IDs | stacks:1 (mainnet), stacks:2147483648 (testnet) |
Supported tokens:
| Token | Type | Mainnet Contract | Testnet Contract |
|---|---|---|---|
| STX | Native | — | — |
| sBTC | SIP-010 | SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token |
ST1F7QA2MDF17S807EPA36TSS8AMEFY4KA9TVGWXT.sbtc-token |
| USDCx | SIP-010 | SP120SBRBQJ00MCWS7TM5R8WJNTTKD5K0HFRC2CNE.usdcx |
ST2Y455NJPETB2SRSD0VDZP3KJE50WNHY0BN3TWY5.usdcx ¹ |
Settlement Implementation Details
The settlement flow has been validated against the existing Go facilitator implementation.
Hiro API endpoints needed:
GET /extended/v1/tx/{txid}— fetch transaction details (status, recipient, amount)POST /v2/transactions— broadcast signed transaction bytes (Content-Type: application/octet-stream)
Free API keys with generous rate limits are available at https://platform.hiro.so.
Transaction parsing — two transaction types to handle:
- STX (native):
tx_type: "token_transfer"— readtoken_transfer.recipient_addressandtoken_transfer.amountdirectly - SIP-010 tokens (sBTC, USDCx):
tx_type: "contract_call",function_name: "transfer"— parse function args foramount(format:u1000000) andrecipient/to(format:'SP…with quote prefix)
Verification rules — after broadcast, poll until confirmed, then verify:
- Transaction status is not
failed,abort_by_response, orabort_by_post_condition - Transaction is confirmed (
status: "success",block_height > 0) - Recipient matches expected address
- Amount >= required minimum
- Optional: sender match, memo match
Reference Implementations
| Resource | Link |
|---|---|
| Stacks facilitator (Go) | https://github.com/x402Stacks/x402-stacks-facilitator |
| x402-stacks npm package | x402-stacks@2.0.1 |
| Crosschain example (EVM + Stacks) | https://github.com/aibtcdev/x402-crosschain-example |
| stx402 (production Stacks x402 service) | https://github.com/whoabuddy/stx402 |
| x402-api (Stacks x402 API service) | https://github.com/aibtcdev/x402-api |