Skip to content
V-Sum

Stellar

Stellar Technical Briefing

Published May 5, 2026

Stellar Technical Briefing thumbnail

Overview

Stellar's James Bachini ships a complete x402 server in 30 lines of code at Day Zero 06: a single Node.js file that gates a "secret number" behind a 0.01 USDC payment on Stellar Pubnet (Stellar's mainnet). The server uses the OpenZeppelin x402 facilitator as a relayer that sponsors transaction fees — agents move USDC at near-zero cost, a new paradigm for agentic systems transacting at scale. Important Stellar gotcha: a recipient wallet must establish a USDC trustline before it can receive payments; James recommends sending a 0.1 USDC test first to verify. On the buyer side, an open-source MCP server is registered into Codex via 'codex mcp add x42-stellar', backed by a hot wallet whose Stellar secret key lives in a .env variable. Codex loads the MCP, recognizes the x402 challenge on a fetch, signs and submits the payment, and returns the secret content — all visible end-to-end on a Stellar block explorer. Server + buyer + first paid microtransaction in under ten minutes.

0:00 x402 in 30 lines on Stellar

James Bachini opens with the goal: a complete x402 server in 30 lines that lets agentic AI systems buy services on Stellar with USDC. Live, end-to-end, on Stellar Pubnet.

0:30 Server config — secret URL, 0.01 USDC price

The server runs locally and gates a "secret number" behind a 0.01 USDC payment. Default asset is USDC; network is Stellar Pubnet (Stellar's mainnet).

1:00 Stellar trustlines — USDC inbound gotcha

A wallet on Stellar must explicitly establish a trustline before it can receive USDC. Best practice: send a 0.1 USDC test from a known wallet first to confirm the trustline before opening the endpoint to live agent buyers.

1:30 OpenZeppelin facilitator — sponsored gas

The OpenZeppelin x402 facilitator acts as a relayer that sponsors transaction fees, so agents can move USDC at near-zero cost. A new paradigm: agents transacting at scale without paying gas themselves.

2:00 x402 middleware — refuse, then collect

How x402 works: the middleware refuses the initial unauthenticated request with HTTP 402, advertises payment terms, and only delivers the protected content after a valid payment is presented.

2:30 Run the server — node + open-source repo

James starts the server with a single node command. Code is open-source on GitHub. Browser hits localhost → 402 paywall page (which can be styled for human buyers; here it's machine-only).

3:30 Client side — MCP server for Codex

Buyer side uses MCP — the Anthropic-originated, now-cross-vendor standard for bolting tools into agent harnesses. James clones his open-source MCP server, runs npm install, and registers it with Codex via "codex mcp add x42-stellar".

4:30 Hot wallet via .env secret key

For agent payments to flow, the agent needs a key. The MCP server reads a Stellar secret key from a .env environment variable — convenient for demos, not the most secure for production.

5:30 Codex MCP inventory — x42-stellar ready

Codex loads the MCP inventory; the x42-stellar tool appears alongside other registered tools. The agent now has the capability to make x402 payments on Stellar autonomously.

6:00 Autonomous purchase — fetch the secret number

Codex is asked to fetch the protected URL using the x42-stellar MCP server. It receives a 402, sends a payment, and returns the secret number — without any per-call human approval.

6:30 Verify the payment on a Stellar block explorer

The transaction ID returned by the MCP shows up on a Stellar block explorer: 0.01 USDC moves from the agent's wallet to the server's payment address (the GA4D... account configured in the 30-line server).

7:00 Closing — full loop in under 10 minutes

End-to-end: 30-line x402 server + Codex MCP buyer agent + Stellar settlement, all live in under ten minutes. Clean foundation for x402 services on Stellar with USDC.

Presented by James Bachini Stellar

Topics:

More from Day Zero 06