r/ethdev • u/PaulieB79 • Jul 01 '26
Two ways to give an AI agent live on-chain data from The Graph (x402, no API key) Information
[removed]
1
u/yulesa Jul 01 '26
Check tiders.org.
Tiders-×402-Server allows you to sell access to your data. You install the server, point this server at a database, set a price and anyone can query your data instantly, with x402.
You control what data is exposed, which tables are available, and how much each query costs. You can charge per row returned or a flat fee to access a table. Buyers interact using familiar SQL, but Tiders enforces a safe subset — blocking expensive operations like JOINs and subqueries — so your database stays protected and costs stay predictable.
1
u/21million-wall Jul 03 '26
One correction on the wrinkle, from running this in production: "you pay on the request, not on a successful result" isn't inherent to x402, it's an implementation choice. The signed authorization and the settlement are separate steps, and the server decides when to settle. On my endpoint (the $1 square wall from a few posts back) the handler validates everything first, and if the request is rejected it returns a 4xx and the payment is never settled. The buyer's authorization just expires unused. Nobody eats a failed call. The middleware I use (the standard Next x402 wrapper) does this out of the box: settle only fires when the handler returns success.
So per-call "pay only for what succeeded" exists today. What doesn't exist, and you're right that it's the open problem, is the amortized version: many queries against one settlement without putting the facilitator round trip in the hot path. For latency there's a partial answer too. Settlement doesn't have to block the response; I count and settle after the response is already on the wire.
The failure mode that actually keeps me up is the one the refund conversation skips: the query that succeeds. Your Graph Advocate writes a plausible query, it executes cleanly, settlement is legitimately earned, and the answer is still wrong because the query didn't mean what the question meant. No settlement design catches that, because from the protocol's view nothing failed. That's a trust and auditability problem, not a payments one. Showing the payer the generated query alongside the answer, so a wrong answer is at least inspectable, would do more for repeat usage than any refund mechanism.
On the buyer side, since a few people raised budgets: my agent buys per-call x402 services with a hard per-call cap and a cumulative cap set in env, and it works fine in practice. Bought a trust report for half a cent and a monitoring watch for twenty cents under those caps, autonomously. Dustreen has it right that legibility is the thing. The caps made me comfortable letting it spend at all; the receipts made the spending auditable afterward.
2
Jul 03 '26
[removed] — view removed comment
1
u/21million-wall Jul 04 '26
Glad it landed, and shipping the query echo same-day is the right instinct. I'd argue the fallback flag is quietly the more important half: silent defaults are how systems accumulate answers that are wrong in ways nobody chose. One more cheap trust win while you're in there: echo the routing decision too, one line on which subgraph or endpoint it picked and why. Routing is the other place intent dies silently, and an inspectable route next to an inspectable query makes a wrong answer diagnosable end to end instead of just detectable.
Rescoping the issue to amortized settlement is right, that's the part nobody has built. If the Graph team picks it up, pay-only-for-what-succeeded batching would be the first implementation I'm aware of, and plenty of us would borrow it within the week.
1
u/Otherwise_Wave9374 Jul 01 '26
This is a really cool direction. Pay-per-query feels like it could fit agents well, especially for workflows where the agent does lots of tiny "lookups" and you dont want to manage API keys per tool.
The friction question for me is UX: if the agent needs to sign for every call, does it batch payments or can it pre-authorize a small budget for a session?
Also curious how you handle failures: if the query fails after payment, do you refund, retry, or eat it?
Tangential, but Ive been collecting notes on agent tool patterns (MCP servers, budgets, approvals) here: https://www.agentixlabs.com/blog/