Skip to main content
The simplest possible Xenarch agent. No frameworks, no abstractions — raw SDK calls showing the complete payment flow.

Setup

Create .env:

Code

main.py

Run

Output

What each step does

  1. load_wallet_or_create() — loads your private key from env or ~/.xenarch/wallet.json. Creates a new wallet on first run.
  2. check_gate(url) — makes an HTTP request to the URL. If the server returns 402, parses the gate details.
  3. execute_payment() — approves USDC and calls split() on the splitter contract. Waits for on-chain confirmation.
  4. verify_payment() — submits the tx hash to Xenarch. Returns a time-limited access token.
  5. Content fetch — re-requests the URL with the Bearer token. Server validates locally and returns content.