Architecture
Three programs, four agents
Shopier buys clothes on Solana. The agent has its own wallet, its own spending policy, its own keys. Every purchase runs through the policy before settling. The page below covers the programs that enforce that and the agents that run inside them.
The four agents
Your agent + the supporting cast
no wallet · compute only
Policy: API rate limits
Acts: Vision decompose · twin-aware fit commentary · live retailer matching
your wallet + your digital twin · Phantom-signed
Policy: spending_policy PDA on Solana
Acts: Decisions tuned to your measurements, palette, and taste · pays USDC under the policy · auto-approves below threshold · hard-blocks above max-per-tx
Shopier treasury keypair
Policy: hardcoded route caps + signature verification
Acts: Activations · pay rent for new users · paymaster for onboarding bundles
creator's wallet
Policy: ed25519-signed look attestations · on-chain cut
Acts: Curate looks · earn 70% net affiliate · run subscription tier · attest provenance
Each agent's authority is enforced by a different Solana program.
Programs, live
Three Anchor programs on Solana devnet. The panel below pulls accounts directly from devnet RPC. Click any program ID for the explorer.
Live on-chain state
Trust container — spending bounds, session-key delegation
2S7hJm57s4VBmBBpqe59XFFibKR9L2ykstMCm8xWreRtbalance
0.001 SOL
data
36 B
program-data
2.022 SOL
instr count
6
Privacy substrate — encrypted likeness, watch policies
Dt3SWQmsAT1vDJyPRCPgMPXi2Rg47niXDVUzo6boFBCUbalance
0.001 SOL
data
36 B
program-data
1.983 SOL
instr count
8
Creator economy — signed looks + subscription splits
G5FE1NnanqQJGNCyqLnKqKonYFWVzyzoAeZ9rUtf8F5ebalance
0.001 SOL
data
36 B
program-data
1.741 SOL
instr count
5
These accounts are fetched from https://api.devnet.solana.comat request time. Click any program ID to verify in Solana Explorer. The instruction list reflects what's callable on the deployed binary — including the new session-key delegation (record_spend_as_delegate) and watch policy (set_watch_policy) primitives that power Shopier's 30-second auto-buy.
The 30-second auto-buy flow
Three on-chain primitives: set_watch_policy, set_delegate, and record_spend_as_delegate. The user signs each one ahead of time. When a match arrives, the agent buys without re-prompting Phantom.
Watch signed
set_watch_policy
User picks celebs, sets a per-look cap, picks notify or auto-buy mode. Phantom signs once. Lives in the WatchPolicy PDA on digital_twin.
Delegate signed
set_delegate
User authorizes an Ed25519 session keypair for N hours, max-per-tx Y. Phantom signs once. Lives in the Delegation PDA on spending_policy.
Auto-buy fires
record_spend_as_delegate
Match arrives. 30s cancel window. If user does nothing, the session key signs the buy — no Phantom prompt. spending_policy re-validates bounds atomically with the USDC transfer.
If our backend is compromised, max loss is the spending-policy cap. If the session key leaks, max loss is max_per_tx × N until the delegation is revoked. Both caps are checked in the program, not in our service.
Policy semantics
- Read-only checks are owner-authed. The check_spend instruction requires the owner's signature even for simulation, so attackers can't probe an arbitrary user's spending state.
- Writes re-validate hard limits. record_spend doesn't trust the prior check_spend; it re-runs all bound checks before mutating the daily counter.
- Rolling daily window. The daily counter resets when 86,400 seconds have elapsed since last_reset_unix. No cron job required.
- Account TTLs auto-extended. Every state-mutating instruction extends the policy and daily account TTLs, so live use keeps the contract alive without manual ledger bumps.
Off-chain components
- Styling agent — Gemini 2.0 Flash (primary), Groq Llama-4-Scout (fallback). Reads twin data to adjust commentary per item.
- Affiliate rail — Skimlinks (or per-merchant direct programs). Click tracker logs attribution to /c/[handle] cookie; webhook ingests sales and splits 70/30 of net commission to the creator.
- Activation receipts— ed25519-signed receipts from theMiracle's brand console. Verified with their public key before treasury operates on a new user's behalf.
- Signed look attestations — Creators sign canonical content hashes with their wallet; the signed_by_pubkey + signature columns make curation provenance verifiable on the public look pages.
Fulfillment bridges
Shopier's programs cover trust, identity, spending caps, and creator splits. They don't cover merchant fulfillment — Nordstrom doesn't take USDC. Two bridges fill the gap, both integrations with existing Solana-ecosystem products.
Bridge A — user-payment
USDC wallet → fiat merchant checkout
User holds USDC; merchant takes Visa/Mastercard. The bridge converts USDC to a fiat-spending instrument (virtual Visa card) at checkout.
- Raenest (primary, African markets) — CBN-licensed. USDT/USDC on Solana converts 1:1 to USD account balance; virtual Visa card draws from that balance. Shopier is in the SuperteamNG × Raenest Frontier track.
- Crossmint (alternative, global) — Headless Checkout API funded by USDC. Different vendor, same shape. Used where Raenest doesn't serve.
- Solana Pay direct (where supported) — for merchants who accept USDC natively. No bridge needed.
Bridge B — revenue → creator
fiat affiliate commission → on-chain creator USDC payouts
Skimlinks pays Shopier USD wires monthly for affiliate-attributed sales. Creators are owed their cut (70/30 of net commission) in USDC. The bridge swaps fiat to USDC via Coinbase Prime or Kraken OTC and batches on-chain payouts to creator wallets.
v0 vs v1
Today: agent USDC settlement on devnet routes to a Shopier-managed merchant address. No real hoodie ships. The on-chain primitives are real; fulfillment is mocked.
v1: replace the mock with a Raenest deposit + virtual card flow for African users, or Crossmint Headless Checkout for other markets. Bridge A code path lives at src/app/api/agent/purchase/route.ts.