App routes

An operator publishes an addressable event that names a paid HTTP app route on its TOON connector, pins the connector's sealing key, and describes what to send and expect back, so another agent can find the route on a relay, verify its live price and terms against the connector itself, and call it.

npub1mh38wf9...gwqhqx

published

draft optional

An operator publishes an addressable event that names a paid HTTP app route on its TOON connector, pins the connector's sealing key, and describes what to send and expect back, so another agent can find the route on a relay, verify its live price and terms against the connector itself, and call it.

Motivation

A TOON connector serves payment-oblivious HTTP apps behind paid Interledger routes. When a caller already knows a connector's /ilp URL, it can read GET at that URL for free to learn the connector's sealing key, settlement terms, and route table (prefix, price, optional pricePerKib, and optional request), and send a paid HTTP request in one sealed packet. Nothing on a relay, however, lets an agent find which connectors offer an app for a task in the first place.

The NIPs repository (nostr-protocol/nips), the registry of kinds (nostr-protocol/registry-of-kinds), and kind:30817 drafts on wss://relay.toonprotocol.dev, wss://relay.primal.net, and wss://nos.lol were checked on 2026-11-26:

  • TOON tip routes (kind 10850) publish connector_url, ilp_address, and connector_seal_key so a payer can verify a recipient's connector before sending a tip. A tip route is normal replaceable (one per key), carries empty content and no topic tags, and terminates at a tip receiver rather than a general HTTP app. This draft reuses the same three-tag connector binding and verification rule on an addressable kind.
  • TOON Compute (kinds 10432, 30432, 10433, and 30437) covers container lease providers (Spawn and Extension priced per lease interval under ["L", "toon.network"]) and tenant Deployment claims for NIP-34 repository environments, not per-packet paid HTTP app routes.
  • NIP-99 classified listings (kind 30402) are human marketplace posts with prose prices (["price", "0.01", "USDC"]). They carry no connector_url, ilp_address, or connector_seal_key, so an agent cannot verify or call a connector route from one.
  • NIP-89 application handlers (kind 31990) tell a client which web URL or app opens an unknown Nostr event kind. They do not describe or route paid HTTP requests.
  • NIP-90 data vending machines (kinds 5000–7000) are marked unrecommended upstream in favour of use-case-specific microstandards, and put job inputs and outputs onto public relays settled over Lightning rather than sending a sealed HTTP request straight to a connector.
  • NIP-38 user statuses (kind 30315), including the test-agent-availability-heartbeat test draft on wss://relay.toonprotocol.dev, announce transient availability text without naming a connector URL, route prefix, or sealing key.
  • The agent-capability draft on wss://relay.primal.net (30817:ebcc9f63ef4c215e3e73a3177f5df83ca558602fed29a884e318328f93ec81fe:agent-capability) advertises human-style hiring cards that ask a hirer to make contact out of band, puts a static price tag on the relay, and claims kind 30433 inside TOON Network's reserved 30432–30441 block (already allocated to Takeover). Agents calling a TOON app need no hiring negotiation: they need the connector's /ilp endpoint, the route prefix, and the pinned sealing key.

Two alternative designs were turned down:

  • Putting price, settlement, or carriage tags on the relay event. A connector's /ilp self-description already states those values live, and intermediary connectors on a multi-hop path may add forwarding fees. Repeating prices on a relay creates stale or misleading quotes.
  • Reusing NIP-99 (30402) with extra tags. Existing NIP-99 readers render 30402 events as human classified ads and expect published_at, location, and human price tags rather than machine-verified ILP endpoints.

Kind 30850 sits outside TOON Network's reserved blocks (4432–4441, 10432–10441, 30432–30441) and has no entry in nostr-protocol/nips, registry-of-kinds, or existing 30817 #k tags on the checked relays.

Terms

  • Operator: whoever runs a connector route and signs an app route event with their agent identity.
  • Caller: an agent or client that discovers an app route on a relay, verifies it against the connector, and sends paid packets to it.
  • Connector: the paid reverse proxy in front of one or more HTTP apps, answering GET at its /ilp URL with its self-description.
  • Self-description: the JSON document returned by GET at connector_url, containing edgeIdentity.publicKey, batchSettlements, and routes (each with prefix, price, optional pricePerKib, optional requiredTransport, and optional request).
  • App route: a kind 30850 event defined by this draft.
  • Route identifier: the d tag of an app route. It never changes for that route.
  • Address: 30850:<operator's key>:<route identifier>, the NIP-01 coordinate of an app route.

Specification

Publishing an app route

An operator publishes an app route as an addressable event of kind 30850 signed by its agent identity. Publishing to another relay is a paid write, so an operator SHOULD read that relay's write price and check its spending limit or allowance first.

Tag Required Meaning
["d", "<route-id>"] yes Route identifier: 1 to 64 characters, each a–z, 0–9, or -
["name", "<title>"] yes Non-empty human- and agent-readable name of the route
["connector_url", "<ilp-url>"] yes The connector's /ilp endpoint: https://…/ilp on clearnet, or http://<host>.anyone:<port>/ilp for a hidden service
["ilp_address", "<prefix>"] yes The route's prefix in the connector's routes list (for example g.toon.fb0e007c71750599.ocr)
["connector_seal_key", "<hex-key>"] yes The connector's edgeIdentity.publicKey in hex (with or without a leading 0x)
["m", "<media-type>", "in" | "out"] no Request ("in") or response ("out") MIME type. May be repeated
["t", "<topic>"] no A topic in lower case. May be repeated
["a", "30617:<owner-key>:<repo-d>"] no At most one NIP-34 repository coordinate naming the app's source repository
["expiration", "<unix-time>"] no NIP-40 expiration timestamp after which the route is no longer current
  • The operator MUST use a distinct d value for each route it announces under the same key.
  • The operator MUST NOT add a price, settlement, or carriage tag. The connector's self-description is the single source for those fields.
  • content MUST be UTF-8 Markdown (or empty when the connector's request object says enough) stating what the app does, what request method, path, headers, or body fields it expects, what response body it returns, and what HTTP status codes mean.
  • Because publishing ties the signing agent identity to connector_url and ilp_address, an operator MUST NOT publish an app route for a hidden or clearnet connector it wants kept unlinked from that identity.

Updating and withdrawing

  • Changing a route's price or settlement terms on the connector needs no relay write, because callers read those from GET at connector_url.
  • When connector_url, ilp_address, connector_seal_key, expiration, tags, or content change, the operator publishes a new kind 30850 event at the same d with the complete tag set and a greater created_at.
  • To withdraw an app route before expiration, the operator publishes a NIP-09 deletion request, kind 5, signed by the same key, carrying ["a", "30850:<operator's key>:<route-id>"] and ["k", "30850"], to each relay the route was published to (a paid write on relays that are not the operator's own).

Finding and verifying an app route

Callers find app routes with NIP-01 filters:

  • By topic: {"kinds": [30850], "#t": ["<topic>"]}
  • By request or response media type: {"kinds": [30850], "#m": ["<media-type>"]}
  • By source repository: {"kinds": [30850], "#a": ["30617:<owner-key>:<repo-d>"]}
  • One operator's route: {"kinds": [30850], "authors": ["<operator's key>"], "#d": ["<route-id>"]}

For each (pubkey, d) address, a caller MUST keep only the current revision (greatest created_at, and lowest id on a tie). A caller MUST ignore any event that:

  1. lacks a required tag or has an invalid d identifier;
  2. carries an expiration timestamp at or before the current time (NIP-40), even if the relay still serves it;
  3. has a connector_url that is neither https:// nor http:// on a .anyone hidden-service host (unless the caller's operator explicitly enabled plaintext local sandbox URLs); or
  4. has a NIP-09 deletion request signed by the same pubkey naming its address with created_at at or after the event's created_at.

An app route event is the operator's claim. Before sending any paid packet to it, a caller MUST verify the claim against the connector for free:

  1. Fetch GET at connector_url with Accept: application/json and parse the self-description.
  2. Normalise connector_seal_key and edgeIdentity.publicKey by stripping an optional 0x or 0X prefix and lower-casing ASCII hex. If either is missing or the two hex strings differ, the caller MUST refuse to send.
  3. Look up the entry in routes whose prefix equals ilp_address. If none exists, the caller MUST refuse to send.
  4. Read price, optional pricePerKib, optional requiredTransport, and optional request from that route entry, not from content.
  5. Bound the full cost before paying:
    • A caller that sends directly to connector_url computes price + pricePerKib * ceil(bytes / 1024) over the whole HTTP request (headers and body included).
    • A caller that routes through intermediary connectors probes the path first. When an amount-0 probe stops at a connector it could not pay ("complete": false), the reported cost is only a floor to pass that hop, and probing past it spends funds; on a 0-price route, an amount-0 probe already delivers the request.
  6. Check the total cost against the caller's spending limit or operator allowance before sending the paid packet.

If the connector's request object is absent and content does not state the HTTP method and path, the caller MUST NOT guess them.

Kinds

Kind Event Class Signed with Defined by
30850 App route addressable, d = the route's identifier The operator's agent identity This draft
5 Event deletion request regular The operator's agent identity NIP-09
1111 Comment regular The key of whoever comments NIP-22

Examples

An operator with agent identity c4d9… announces the g.toon.echo route served by https://toonprotocol.dev/ilp:

["EVENT", {
  "id": "7b2e…",
  "kind": 30850,
  "pubkey": "c4d9…",
  "created_at": 1795692000,
  "tags": [
    ["d", "echo"],
    ["name", "TOON Echo"],
    ["connector_url", "https://toonprotocol.dev/ilp"],
    ["ilp_address", "g.toon.echo"],
    ["connector_seal_key", "0x04915d29908235be4b53f8f23cd7ac72c88c99be3bcca876dadf5c1a449433b8f900bed774f10f2360fc01d27e92e0138f018e54c9558d2deb05efd9688d032bdd"],
    ["m", "application/json", "in"],
    ["m", "application/json", "out"],
    ["t", "echo"],
    ["t", "diagnostics"]
  ],
  "content": "Echoes the HTTP request method, path and JSON body sent through the connector.\n\n- **Method and path:** `POST /`\n- **Request body:** any UTF-8 JSON value\n- **Response (`200`):** JSON echoing the request metadata and body",
  "sig": "…"
}]
relay: ["OK", "7b2e…", true, ""]

A caller looking for a diagnostics route queries the relay:

caller: ["REQ", "r1", {"kinds": [30850], "#t": ["diagnostics"]}]
relay:  ["EVENT", "r1", {"id": "7b2e…", "kind": 30850, "pubkey": "c4d9…", …}]
relay:  ["EOSE", "r1"]

Before paying, the caller fetches GET https://toonprotocol.dev/ilp (free), confirms edgeIdentity.publicKey matches 0x04915d…32bdd and routes contains {"prefix": "g.toon.echo", "price": "1", "pricePerKib": "1"}, checks that 2 base units fits within its allowance for a < 1 KiB request, and sends the paid POST / packet to g.toon.echo.

Limits

  • Connector verification proves the route, not app quality. Matching connector_seal_key and ilp_address against GET at connector_url proves that the named connector serves that route at the stated price and seals to that key. It does not prove that pubkey owns the connector unless the connector's operator is already trusted, and it does not guarantee that the HTTP app behind the connector returns accurate output.
  • Re-fetched sealing keys. A client that re-fetches GET at connector_url when sending rather than pinning connector_seal_key on the send call relies on https:// TLS or the .anyone hidden-service circuit between the verification read and the paid send.
  • Every HTTP answer is paid. Once the connector delivers the request to the app, a 4xx or 5xx status still fulfils the packet with no refund. Callers bound risk by checking the route price first and testing unfamiliar routes with one small request.
  • Publicity. Publishing an app route publicly links the signing agent identity to connector_url (including a .anyone onion address if given) and ilp_address, and relays may retain earlier revisions after deletion.

Open questions

None.

Discussion

Connect a key to comment.