Docs · Get started
Quickstart
Quote an aggregate, pay it, check the receipt. Five minutes with the SDK served from this site.
- Load the SDK from
/sdk/pod.mjs. It has no dependencies. - Ask for a quote. Quotes are free and show the plates in scope.
- Run the query with any account that can sign typed data. The SDK answers the 402 with an EIP-3009 authorization in USDG.
- Check the output against the receipt the Meter recorded.
Load the SDK
import { createClient } from "https://proofofdata.app/sdk/pod.mjs";
import { privateKeyToAccount } from "viem/accounts";
const pod = createClient({ base: "https://proofofdata.app", meter: process.env.POD_METER });
const account = privateKeyToAccount(process.env.RENTER_KEY);Get a quote
const q = await pod.quote("commute-minutes-by-weekday");
// 503 { error: "enclave_not_running", quote: { platesInScope, priceUsdg } } until an enclave is liveRun and pay
const r = await pod.query({ aggregate: "commute-minutes-by-weekday", account });
// r.body.output { aggregate, groups: { Mon: { value: 27, plates: 30 }, ... } }
// r.body.receipt { queryId, platesRead, price, outputHash, ... }The renter's deposit (5 USDG minimum) must be in the Meter first: call deposit(amount) or depositWithAuthorization. It is what a canary slashes.
Verify the receipt
const v = await pod.verifyReceipt({ queryId: r.body.receipt.queryId, output: r.body.output });
// { settled: true, matches: true, platesRead, price, tx }