X402 erc7710

From internet-court/internet-court-skill · View interactive version

X402 erc7710 is an AI agent skill from the GitHub repository internet-court/internet-court-skill. Design and implement demos combining x402 HTTP payments with ERC-7710 smart contract delegations and ERC-7715 wallet permission requests for subscriptions, bounded agent budgets, recurring spend, pay-per-use APIs, and agentic commerce.

How to use this skill

Skill file

x402 + ERC-7710

Use this skill when a user wants a payment or subscription demo where an agent pays for HTTP resources through x402 and spends only within a bounded delegated permission.

Core Model

Use x402 for "pay now for this HTTP request." Use ERC-7710/7715 for "this agent may keep paying under these constraints."

Discovery-First Boundary

When the user has only asked to use or inspect a paid HTTP service, stay in discovery mode:

  1. Identify the relevant endpoint or resource.
  2. Confirm whether it returns 402 Payment Required.
  3. Summarize the advertised x402 requirements: network, token, amount, payee, route, and extra.assetTransferMethod when present.
  4. State that no paid request has been made.
  5. Ask whether the user wants to set up bounded payment authority.

Do not draft a subscription, mandate, cadence, schedule, spend cap, expiration, or wallet permission until the user asks for setup or confirms they want to continue. Do not infer "daily", "weekly", or "recurring" authority from a product objective alone; wait for the user to approve delegation design.

Good discovery response shape:

I found the paid endpoint and its x402 requirements.

- Endpoint: GET /path
- Network: ...
- Token: ...
- Price: ...
- Payee: ...

I have not made a paid request. Do you want me to help set up bounded payment authority for this task?

Trust Objection Mode

When the user objects to trusting the agent with money, keep the options distinct:

Do not assign exact route, price, cadence, or expiry values to the Basic option. Those constraints belong in Guarded or Adjudicated setup after the user chooses that path.

Adjudicated Setup Mode

When the user selects adjudicated authority, proceed to setup instead of drafting a final mandate artifact immediately.

The right response is operational:

  1. confirm adjudicated mode;
  2. state that setup may take a while;
  3. list the steps to create an agent session key, prepare the bounded wallet permission request, open user wallet approval, store the permission artifact, verify the x402 requirements, configure signed evidence, and prepare the review path;
  4. ask the user to approve the guarded wallet permission in their wallet UI;
  5. wait for the user's approval message.

Do not ask for arbitrary expiration, schedule, or spend-cap choices in this beat unless the previous conversation lacks enough facts to create a safe testnet permission request. Do not claim the permission is ready before the user approves it.

Subscription Pattern

For subscriptions, do not make x402 stateful. Keep x402 as the request payment protocol and put recurrence in the delegated spend policy.

Recommended policy fields:

type AgentSpendPolicy = {
  delegator: `0x${string}`;
  delegate: `0x${string}`;
  token: `0x${string}`;
  allowedPayTo: `0x${string}`;
  allowedResourcePattern: string;
  maxPerRequest: bigint;
  maxPerPeriod: bigint;
  periodSeconds: number;
  validAfter: number;
  validUntil: number;
  chainId: number;
  revocable: boolean;
};

Execution flow:

  1. User grants a scoped permission through wallet UX, ideally ERC-7715 when available.
  2. The returned permission context is stored by the agent or subscription manager.
  3. Agent requests an x402-protected endpoint.
  4. Server returns payment requirements.
  5. Agent verifies requirements against the policy: network, token, amount, merchant, route, expiry, and remaining budget.
  6. Agent redeems the ERC-7710 delegation or otherwise executes through the user's smart account to produce the payment authorization.
  7. Agent retries the HTTP request with the x402 payment payload.
  8. Server or facilitator verifies and settles payment.
  9. Subscription manager records spend and receipt for audit, revocation, and disputes.
  10. For supervised wallets, a reporter contract or watcher submits spend snapshots to GenLayer on the review cadence.

Default Demo

Build Agent Research Pass unless the user asks otherwise:

Browser Lab Pattern

When building an exploratory dashboard, use this shape:

The exported agent package is a bearer capability in demo form. Include explicit warnings, keep caps tiny, and never export production private keys.

The same delegated-wallet pattern can support non-x402 actions when the wallet and delegation manager expose them: ERC-20 allowance, ERC-20 periodic spend, ERC-20 streams, native token permissions, token approval revocation, and general contract executions through delegation scopes.

Conversational Operator Mode

When the user wants to operate this demo by talking to Codex instead of using a UI, offer a concrete menu before implementing:

  1. Inspect x402 resources and confirm extra.assetTransferMethod = "erc7710".
  2. Generate or import a real Base Sepolia agent wallet.
  3. Draft an ERC-7715 permission request for MetaMask approval.
  4. Build an agent JSON package containing agent key, permission context, allowed resources, budgets, and GenLayer control metadata.
  5. Run or prepare an agent x402 payment attempt from that package.
  6. Build a GenLayer decision payload for continue, warn, constrain, revoke, or escalate.
  7. Apply a revocation/constrain decision through the local EVM controller path when configured.
  8. Extend the demo to non-x402 delegated actions such as token budgets, native token budgets, approval revocation, or contract calls.

Ask direct implementation choices when the user has not specified them, especially:

State the wallet boundary clearly: Codex can prepare the ERC-7715 request, scripts, and artifact, but the user must approve MetaMask wallet prompts. Do not claim Codex can silently grant wallet permissions.

MetaMask Transaction Cards

When the user wants to deploy or configure contracts from MetaMask or WalletConnect:

For the local Internet Court x402 demo, WalletSpendReporter takes the Base BridgeSender.sol address 0x7AB80AE93246108bd1e80b8215c5F1147Ca56af0 as initialBridgeSender. Do not use the Base BridgeReceiver address 0xF92d8e5F1620E464eEac5fab5472dA06fbfA5C73 or the GenLayer BridgeSender Intelligent Contract there. The GenLayer BridgeSender Intelligent Contract is only for the GenLayer supervisor constructor.

For the local Internet Court x402 demo, GenLayerDecisionReceiver.initialSourceContract is the GenLayer supervisor address once known. If the supervisor is not deployed yet, ask for an explicit temporary nonzero placeholder and label it as temporary; never silently use the GenLayer BridgeSender Intelligent Contract as that placeholder.

Periodic GenLayer Control

For supervised delegated payments, model review cadence in the mandate and artifact:

Never say GenLayer directly revokes ERC-7710 unless the EVM-side controller or caveat check has been wired into the redemption path.

Other Demo Ideas

Implementation Checklist

When asked to implement or spec a demo, produce:

  1. Resource server routes and x402 payment requirements.
  2. Buyer agent wallet and delegated permission policy.
  3. Permission request shape, noting whether ERC-7715 is available in the target wallet.
  4. Policy validation before each payment.
  5. Payment receipt store with parent request id, route, amount, token, chain, merchant, tx hash, and timestamp.
  6. Spend snapshot source, such as an x402 permission manager with spent, requestCount, and a generic getDelegatedSpendSnapshot.
  7. GenLayer bridge reporter and decision receiver addresses for Base Sepolia when the demo needs bridge-backed revocation.
  8. Revocation and expiry behavior.
  9. Dispute path and evidence bundle.
  10. Test plan with over-budget, wrong merchant, expired permission, wrong route, failed settlement, stale bridge decision, duplicate bridge message, and replay attempts.

Guardrails

Signed Evidence Pattern

For paid report or API-resource demos using x402 plus review guardrails:

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.