Skip to main content
A delegate is a key that spends an existing subscription. The owner keeps the cold key and the prepaid plan; the agent or service holds a hot key that can request rounds within a cap the owner sets on chain and the gateway enforces. This is the alternative to x402 pay-per-request. Use a delegate when someone already pays for a Molpha subscription and wants an agent to spend that quota, not when the agent should pay USDC per request.

Use a delegate when

  • A team already has an active subscription.
  • The agent should not hold the owner’s USDC or subscription key.
  • You want a cap on how many rounds the agent can request.
  • You want to cut the agent off with one transaction.

On-chain account

Seeds:
The owner creates it with the program’s add_delegate instruction and removes it with remove_delegate, which closes the account. There is no pause instruction. add_delegate requires an active subscription, a delegate key different from the owner, max_data_requests greater than 0, and a free slot under the subscription’s max_delegates (100 on the Basic plan). The web app’s Access page (https://app.molpha.io/console/access) builds both instructions for a connected owner wallet.

Flow

  1. The owner opens or extends a subscription.
  2. The owner calls add_delegate with the agent’s public key and max_data_requests.
  3. The agent authenticates on POST /v1/round/execute in one of two ways:
    • RequestAuth: consumerAuthority is the agent’s key, subscriptionOwner is the owner, and the agent signs authSig with a fresh authTimestamp (unix seconds) for every request.
    • A sign-in session: the agent requests a sign-in challenge with address set to its key and owner set to the owner, signs it, exchanges it at POST /v1/session, and sends the bearer token instead of RequestAuth.
  4. The gateway reads the subscription and the Delegate account from chain, stamps the round and returns the signed attestation.
  5. The round counts against the subscription’s max_rounds and the delegate’s max_data_requests for the current term (see Terms and quota).
The sourceId is the hash of the canonical source only. Owner and delegate requests for the same source share it, and their requests in the same 100 ms tick share one round, each spending its own quota unit. The consumer key is part of the gateway’s replay identity, not of the source.

Controls

A delegate signed in with a session can read its own usage and cap at GET /v1/session.

Next steps

Subscriptions

Open the plan that backs the delegate.

x402 pay-per-request

Pay-per-request path when there is no subscription.