Events and webhooks
Voynich exposes every settled receipt, benchmark, quorum, batch, pass, referral, split, and bond update over both a newest-first JSON feed (GET /v1/events/recent) and a filtered Server-Sent Events stream (GET /v1/events/stream). You can browse live mainnet activity on /live ↗, consume filtered streams in code with watchEvents, or run voynich watch to relay signed HTTP POST webhooks to your own backend.
Stream and relay from the CLI#
Use voynich watch to stream filtered live events to stdout as newline-delimited JSON, or pass --webhook and --secret to relay every matching event as an HMAC-SHA256 signed HTTP POST:
voynich watch --model text-1m --types receipt.settled,benchmark.published --api https://api.voynich.devvoynich watch \
--model text-1m \
--types receipt.settled,quorum.updated \
--webhook https://example.com/hooks/voynich \
--secret "$VOYNICH_WEBHOOK_SECRET" \
--api https://api.voynich.devvoynich watch needs no wallet. Without --webhook, each event envelope prints as one JSON line on stdout. With --webhook, each delivery prints { "delivered", "status", "event", "id", "signed" } to stdout. receipt.settled and receipt.created are treated as aliases in --types.
Query and subscribe from the SDK#
Use recentEvents for recent indexed history and watchEvents for a live filtered async generator (both browser and Node compatible):
import voynich from 'voynich'
// 1. Read recent indexed events (newest-first by slot)
const recent = await voynich.recentEvents({
model: 'text-1m',
types: ['receipt.settled', 'benchmark.published'],
limit: 30,
})
console.log(recent.items.length, recent.asOf)
// 2. Subscribe to the filtered live SSE stream
const controller = new AbortController()
for await (const event of voynich.watchEvents({
model: 'text-1m',
types: 'receipt.settled,benchmark.published',
signal: controller.signal,
})) {
console.log(event.type, event.id, event.timestamp, event.data)
}recentEvents(opts?)Promise<RecentEventsResponse>Calls GET /v1/events/recent with optional model (address or slug), types (CSV string or string array), limit (1..100, default 30), and signal. Returns { items: RecentEvent[], asOf }.
watchEvents(opts?)AsyncGenerator<ProgramEvent, void, void>Opens GET /v1/events/stream with optional model, types, includeReady, and signal (AbortSignal), yielding validated ProgramEvent envelopes as they arrive.
Sign and verify HMAC-SHA256 webhooks#
Every HTTP POST sent by voynich watch --webhook or deliverWebhookEvent carries three headers:
| Header | Constant | Value |
|---|---|---|
X-Voynich-Event | WEBHOOK_EVENT_HEADER | The event type (for example receipt.settled, benchmark.published, quorum.updated). |
X-Voynich-Delivery | The unique event delivery id (event.id). | |
X-Voynich-Signature-256 | WEBHOOK_SIGNATURE_HEADER | sha256=<64-hex> HMAC-SHA256 over the raw UTF-8 JSON request body when a secret is configured. |
Verify the signature in constant time on the receiving server against the raw request body bytes before parsing or acting on the payload:
import {
verifyWebhookSignature,
signWebhookPayload,
deliverWebhookEvent,
WEBHOOK_SIGNATURE_HEADER,
WEBHOOK_EVENT_HEADER,
} from 'voynich'
// Receiving HTTP handler (Node, Express, Hono, Next.js Route Handler, Cloudflare Worker)
export async function POST(request: Request) {
const rawBody = await request.text()
const sig = request.headers.get(WEBHOOK_SIGNATURE_HEADER) ?? ''
const eventType = request.headers.get(WEBHOOK_EVENT_HEADER) ?? ''
if (!verifyWebhookSignature(rawBody, sig, process.env.VOYNICH_WEBHOOK_SECRET!)) {
return new Response('Invalid signature', { status: 401 })
}
const event = JSON.parse(rawBody)
console.log('Verified Voynich event:', eventType, event.id)
return new Response('ok', { status: 200 })
}signWebhookPayload(payload, secret) and verifyWebhookSignature(payload, signatureHeader, secret) use @noble/hashes HMAC-SHA256 with constant-time comparison and have zero Node-only imports, so they run in Node, edge workers, and browsers. To send a signed webhook directly from your own code, call deliverWebhookEvent({ url, event, secret?, fetch?, signal? }).
HTTP endpoints and event shape#
GET /v1/events/recent#
Returns newest-first indexed events synthesized from receipt, benchmark, quorum, batch, referral, pass, split, and bond records:
GET /v1/events/recent?model=text-1m&types=receipt.settled,benchmark.published&limit=20Each item in items has this shape (RecentEvent):
idstringrequiredStable event identifier.
typeRecentEventTyperequiredEvent type (receipt.settled, benchmark.published, quorum.updated, batch.updated, referral.updated, pass.updated, split.updated, bond.updated).
modeladdress or nullrequiredModel account address associated with the event, when applicable.
modelNamestring or nullrequiredModel slug associated with the event, when applicable.
slotslotrequiredSolana slot at which the event occurred.
timestamptimestamprequiredISO 8601 UTC timestamp.
dataobjectrequiredFull event payload matching the corresponding resource schema.
GET /v1/events/stream and GET /v1/events#
Both SSE routes accept ?model=<address|slug>&types=<csv> query filters and stream text/event-stream envelopes { id, type, timestamp, data } with : keepalive heartbeats every 15 seconds. See HTTP API: Overview for the full list of event types and resync behavior.
Live network screen (/live)#
Visit https://voynich.dev/live to watch recent and live mainnet events in the browser with one-press model filter pills (All, text-1m, sketch-32, and other live models), event type badges, direct links to /receipts/<address> and /models/<slug>, and a copyable voynich watch webhook command pre-filled with your active filter.