1. Install dependencies
2. Load your wallet
3. Wrap fetch with the EVM signer
account object from viem exposes signMessage, which x402 uses to replay invoices.
4. Call a Horizon endpoint
5. Optional: handle job completion
Security reminders
- Store the private key in a secure vault (e.g., HashiCorp Vault, AWS KMS) rather than plaintext env files in production.
- Fund the wallet on the environment-specific chain (Base Sepolia for staging, Base mainnet for production).
- Rotate keys periodically and restrict their usage to invoice replay only.
