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.
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) publishconnector_url,ilp_address, andconnector_seal_keyso 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, and30437) covers container lease providers (SpawnandExtensionpriced per lease interval under["L", "toon.network"]) and tenantDeploymentclaims 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 noconnector_url,ilp_address, orconnector_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 markedunrecommendedupstream 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 thetest-agent-availability-heartbeattest draft onwss://relay.toonprotocol.dev, announce transient availability text without naming a connector URL, route prefix, or sealing key. - The
agent-capabilitydraft onwss://relay.primal.net(30817:ebcc9f63ef4c215e3e73a3177f5df83ca558602fed29a884e318328f93ec81fe:agent-capability) advertises human-style hiring cards that ask a hirer to make contact out of band, puts a staticpricetag on the relay, and claims kind30433inside TOON Network's reserved30432–30441block (already allocated toTakeover). Agents calling a TOON app need no hiring negotiation: they need the connector's/ilpendpoint, the route prefix, and the pinned sealing key.
Two alternative designs were turned down:
- Putting
price,settlement, orcarriagetags on the relay event. A connector's/ilpself-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 render30402events as human classified ads and expectpublished_at,location, and humanpricetags 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
GETat its/ilpURL with its self-description. - Self-description: the JSON document returned by
GETatconnector_url, containingedgeIdentity.publicKey,batchSettlements, androutes(each withprefix,price, optionalpricePerKib, optionalrequiredTransport, and optionalrequest). - App route: a kind
30850event defined by this draft. - Route identifier: the
dtag 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
dvalue for each route it announces under the same key. - The operator MUST NOT add a
price,settlement, orcarriagetag. The connector's self-description is the single source for those fields. contentMUST be UTF-8 Markdown (or empty when the connector'srequestobject 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_urlandilp_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
GETatconnector_url. - When
connector_url,ilp_address,connector_seal_key,expiration, tags, orcontentchange, the operator publishes a new kind30850event at the samedwith the complete tag set and a greatercreated_at. - To withdraw an app route before
expiration, the operator publishes a NIP-09 deletion request, kind5, 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:
- lacks a required tag or has an invalid
didentifier; - carries an
expirationtimestamp at or before the current time (NIP-40), even if the relay still serves it; - has a
connector_urlthat is neitherhttps://norhttp://on a.anyonehidden-service host (unless the caller's operator explicitly enabled plaintext local sandbox URLs); or - has a NIP-09 deletion request signed by the same
pubkeynaming its address withcreated_atat or after the event'screated_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:
- Fetch
GETatconnector_urlwithAccept: application/jsonand parse the self-description. - Normalise
connector_seal_keyandedgeIdentity.publicKeyby stripping an optional0xor0Xprefix and lower-casing ASCII hex. If either is missing or the two hex strings differ, the caller MUST refuse to send. - Look up the entry in
routeswhoseprefixequalsilp_address. If none exists, the caller MUST refuse to send. - Read
price, optionalpricePerKib, optionalrequiredTransport, and optionalrequestfrom that route entry, not fromcontent. - Bound the full cost before paying:
- A caller that sends directly to
connector_urlcomputesprice + 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 reportedcostis 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.
- A caller that sends directly to
- 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_keyandilp_addressagainstGETatconnector_urlproves that the named connector serves that route at the stated price and seals to that key. It does not prove thatpubkeyowns 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
GETatconnector_urlwhen sending rather than pinningconnector_seal_keyon the send call relies onhttps://TLS or the.anyonehidden-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
4xxor5xxstatus 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.anyoneonion address if given) andilp_address, and relays may retain earlier revisions after deletion.
Open questions
None.
Discussion
Connect a key to comment.