Skip to content

docs: decide USDC-over-SAC payment rail and testnet agent-wallet custody (ADR-0003) with a verified testnet payment PoC - #59

Merged
XxHugheadxX merged 1 commit into
mainfrom
docs/7-payments-and-wallets
Sep 26, 2026
Merged

XxHugheadxX merged 1 commit into
mainfrom
docs/7-payments-and-wallets

Conversation

@XxHugheadxX

Copy link
Copy Markdown
Contributor

Closes #7

Summary

Decides how consumers pay agents and who holds agent keys, with a real testnet payment as proof.

Decisions

  1. Rail: direct USDC transfer through the SAC to the agent's muxed address, whose muxed id is the hire id. The SAC's transfer event returns it as to_muxed_id, so one event proves who was paid, how much, and for which hire. No x402, MPP SDK, or escrow in the MVP.
  2. The server verifies over plain HTTP (getTransaction, xdrFormat: "json") and accepts a payment only if: status is SUCCESS; the event comes from the configured USDC SAC (a look-alike token must not pass); to is the agent wallet; the amount matches exactly; to_muxed_id is the hire id; and the tx hash was not used before. The PoC showed the same hire can be paid twice, so the server must dedupe.
  3. Agent wallets: server-custodied G-accounts, testnet only. Mainnet is blocked until agent wallets move to smart accounts with spending limits.
  4. Server-side signing with stellar_dart (pure Dart), inside the Serverpod LedgerPort adapter. Fallback: a TypeScript sidecar.
  5. set_agent_wallet two-party auth: the agent account is the transaction source (server signs), and the builder signs only their authorization entry with Freighter's signAuthEntry.

Acceptance criteria

Verification evidence

$ cd spikes/payments-poc && HIRE_ID=7 bash pay.sh
...
5/6 pay: transfer 5000000 stroops to the agent, muxed id = hire 7
    to MAV3KOEEBJC77IP4T2JT7FDUTQ5Y5GJXTIZGRG4CZFZ3GZX7V6IUOAAAAAAAAAAAA4A5I
6/6 verify over plain HTTP (getTransaction, xdrFormat=json)
    ✓ SUCCESS · to GAV3KOEEBJC77IP4T2JT7FDUTQ5Y5GJXTIZGRG4CZFZ3GZX7V6IUPBUK · amount 5000000 · hire 7

tx hash: 17ac14e085609df8e042b84e6c25aac7e1c30344eaa1b1fd0bcbed399b65243f

Explorer: https://stellar.expert/explorer/testnet/tx/17ac14e085609df8e042b84e6c25aac7e1c30344eaa1b1fd0bcbed399b65243f

Negative checks on the same transaction, with the script's matching rules:

Check Value Result
hire id 7 / 8 / 70 accept / reject / reject
amount 5000000 / 4999999 / 50000000 accept / reject / reject
emitting SAC expected / other contract id accept / reject

Secret scan on the diff (S[A-Z2-7]{55}): no matches. git check-ignore confirms .env.example is tracked while .env, .env.local and .env.production stay ignored.

Notes for reviewers

…stnet PoC

Consumers pay agents with a direct USDC transfer through the SAC to the agent's muxed address, whose muxed id is the hire id. The server verifies over plain HTTP (getTransaction, xdrFormat json): status, emitting SAC, recipient, exact amount, hire id, and unused tx hash. Agent wallets are server-custodied G-accounts on testnet only; mainnet needs smart accounts. Server signing uses stellar_dart. spikes/payments-poc/pay.sh makes and verifies a real testnet payment. Resolves the deploy signing steps left pending in ADR-0004 (#33). Allows .env.example files through .gitignore.
@XxHugheadxX XxHugheadxX added this to the Stellar Elite (Oct 10) milestone Sep 26, 2026
@XxHugheadxX XxHugheadxX added area: architecture System design, diagrams, contracts between layers type: spike Time-boxed research with a written deliverable P0 Blocks a deadline deliverable labels Sep 26, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying puls3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: e811502
Status: ✅  Deploy successful!
Preview URL: https://a297e7f6.puls3-4lw.pages.dev
Branch Preview URL: https://docs-7-payments-and-wallets.puls3-4lw.pages.dev

View logs

@XxHugheadxX
XxHugheadxX merged commit 9cfad86 into main Sep 26, 2026
3 checks passed
XxHugheadxX added a commit that referenced this pull request Sep 26, 2026
contracts/README.md points to it; it was missing because .gitignore ignored every .env.example until #59.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: architecture System design, diagrams, contracts between layers P0 Blocks a deadline deliverable type: spike Time-boxed research with a written deliverable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spike: agent payment rail and wallet custody on Stellar

1 participant