smart-contracts/backlog/docs/402_CRDT_CrossChain_Fiat_Re...

7.6 KiB

402 / CRDT Tokens / Cross-Chain / Fiat Integration Research

1. HTTP 402 Payment Required Protocol

x402 (Coinbase/Cloudflare) — EVM + Stablecoin Rail

x402 is the EVM-native micropayment protocol using the HTTP 402 status code. Launched May 2025, V2 in September 2025.

How it works:

  1. Client requests paid resource
  2. Server returns HTTP 402 with payment details (amount, token, chain, recipient)
  3. Client signs an EIP-3009 transferWithAuthorization (gasless for USDC/EURC) or Permit2 for any ERC-20
  4. Client re-sends with payment proof in header
  5. Facilitator settles on-chain; server delivers resource

Key details:

  • Canonical proxy: 0x402085c248EeA27D92E8b30b2C58ed07f9E20001 (same address on all chains via CREATE2)
  • Chains: Base, Base Sepolia, Polygon
  • USDC on Base: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
  • Any ERC-20 via Permit2 (x402ExactPermit2Proxy)
  • 1,000 tx/month free tier on hosted facilitator
  • 100M+ payments processed, $35M+ value by late 2025
  • SDK: @x402/core, @x402/evm, @x402/express, @x402/next, @x402/fetch, @x402/paywall
  • Docs: https://docs.cdp.coinbase.com/x402/welcome
  • Spec: https://github.com/coinbase/x402

L402 (Lightning Labs) — Bitcoin Lightning Rail

L402 uses Lightning Network invoices + macaroon bearer credentials.

  • WWW-Authenticate: L402 token="<macaroon>", invoice="<bolt11>"
  • Client pays invoice, gets preimage, sends Authorization: L402 <base64(macaroon:preimage)>
  • Stateless HMAC verification — no database lookup
  • Macaroon caveats for rate limits, expiry, service tiers
  • Cloudflare processing 1B+ 402 responses/day
  • Docs: https://docs.lightning.engineering/the-lightning-network/l402

Community Token Use Cases

  • API metering: Pay per request for community data APIs, AI inference
  • Content paywalls: @x402/paywall for token-gated content
  • Agent-to-agent commerce: AI agents pay with community tokens via Permit2
  • Revenue routing: Custom facilitator routes fees to community treasury

No L402↔EVM bridge exists — choose one rail per use case.


2. CRDT Tokens

Status: Research Only — No Production Implementations

CRDTs (Conflict-free Replicated Data Types) allow concurrent, independent updates across replicas that automatically converge without coordination.

UAT20 — Most Developed Proposal

  • arXiv Feb 2025: https://arxiv.org/abs/2502.08919
  • Solves: Liquidity fragmentation across rollups (USDC on Arbitrum ≠ USDC on Optimism)
  • Each rollup holds a CRDT replica of unified user balance
  • Transfers are local operations, periodically broadcast to L1 and propagated
  • Conflict resolution via two-phase commit (reject one concurrent spend)
  • Status: Preprint only, not implemented

Other Academic Work

  • FabricCRDT: CRDT integration for Hyperledger Fabric (permissioned chains)
  • OrderlessChain: CRDT-based BFT blockchain eliminating global ordering

Relationship to Existing Tech

State Channels CRDT Tokens Optimistic Rollups
Setup On-chain deposit required None Bridge deposit
Coordination All parties online Independent, offline-capable Sequencer
Finality Fast off-chain Eventual consistency 7-day dispute period
Best for Bilateral payments Multi-party ledgers General compute

Practical Implication

CRDT tokens are not deployable today. The existing src/crdt/ modules in myco-bonding-curve (labor_crdt.py, batch_settlement.py, intent_matching.py) are ahead of the industry. UAT20 provides a blueprint for future cross-rollup balance unification.


3. Cross-Chain Interoperability

Protocol Comparison

Protocol Chains Model Speed Security Best For
CCIP 60+ Message passing 10-30 min Risk Management Network (separate oracle set) State sync, programmable transfers
LayerZero V2 132 DVN + Executor 1-5 min Configurable DVN set Native multichain token (OFT)
Wormhole NTT 40+ Guardian network 1-15 min Global Accountant (supply monitoring) Token sovereignty, Solana support
Axelar GMP 50+ DPoS validators 5-20 min 2/3 validator majority Cosmos/IBC chains
Across (ERC-7683) 15+ Intent/relayer ~seconds Economic (relayer fronts funds) Fast user deposits
LI.FI 20+ bridges Aggregator Varies Routes through best bridge User UX abstraction

Layer 1 — State Sync: Chainlink CCIP

  • Hub on Base, spokes on ETH/ARB/OP/Polygon
  • Arbitrary messaging for bonding curve state (price, reserve, tranche health)
  • Programmable token transfers: send collateral + instructions atomically
  • Risk Management Network prevents corruption
  • Docs: https://docs.chain.link/ccip

Layer 2 — Native Token: LayerZero OFT or Wormhole NTT

Layer 3 — Fast UX: Across + ERC-7683 or LI.FI

  • Near-instant deposits from any chain (relayers front funds)
  • ERC-7683 is becoming the standard (Uniswap, Optimism Superchain adopted it)
  • LI.FI auto-routes through optimal bridge
  • Spec: https://www.erc7683.org/

CCIP Cross-Chain Token (CCT) Standard


4. Fiat On/Off Ramps

Provider Matrix

Provider Base Chain Custom ERC-20 Cost Best For
Coinbase Onramp Native (free USDC) No (ETH/USDC only) Free for USDC Base-native users, gasless
Bridge.xyz Yes Yes (xUSD issuance) Enterprise pricing Custom stablecoin, B2B
Transak Yes Yes (with listing) 1-5% Global coverage, 170+ tokens
MoonPay Yes Yes (with review) 1-4.5% Consumer UX, fraud handling
Ramp Network Yes Yes (via partnership) Varies Fast go-live (~2 weeks)
Stripe Onramp Limited No Stripe fees Existing Stripe merchants
Onramper Aggregated Aggregated Routes to cheapest Multi-provider routing

Immediate (USDC rail):

User fiat → Coinbase Onramp → USDC on Base (free, gasless)
  → bondingCurve.buy(usdcAmount) → Community token minted

Phase 2 (Custom stablecoin via Bridge.xyz):

User fiat → Bridge.xyz → Community-branded stablecoin (cUSD)
  → xUSD backing → bonding curve → Community token

Phase 3 (Direct listing):

Bridge.xyz Key Details

  • Custom stablecoin issuance (xUSD): Deploy branded stablecoin, 1:1 USD-backed
  • API: POST /v0/transfers for fiat↔stablecoin swaps
  • Reserve transparency endpoints
  • Backed by Stripe ($1B valuation)
  • Contact: sales@bridge.xyz
  • Docs: https://apidocs.bridge.xyz

Regulatory Considerations

  • Using licensed onramp (Transak, MoonPay, Coinbase) offloads MSB/KYC/AML obligations
  • GENIUS Act (July 2025): Federal stablecoin law — applies if token is fiat-pegged, requires 1:1 reserves + monthly audits
  • Howey Test: Design community tokens as utility/governance, NOT investment instruments
  • Practical: Fiat → USDC (via licensed onramp) → bonding curve is the safe path