all entities

About

How Arkiv SQL works

Two parts. An open source indexer that anyone can self host, and this app, which runs on a hosted instance that indexes all Arkiv data on the Rabdi testnet. This page explains both, and how to check each claim yourself.

MIT licensed. Built for Arkiv: Global Tour Stop, within the challenge window of 9 October 2026 to the extended deadline of 20 October 2026, on the Tiramisu testnet (chain 7738577) with Arkiv SDK 0.8.1. The git history runs from 18 to 20 October 2026; pre-existing work: none. Source on GitHub

Why SQL over Arkiv

arkiv_query filters and pages. It returns at most 200 results per page, newest first, with no JOIN, no GROUP BY, no ORDER BY on attributes and no aggregation beyond a count. That answers “give me this entity”. It does not answer “which wallets create the most entities?”

With arkiv_query

  1. Page through every live entity, 200 per call, on a shared rate limited budget.
  2. Collect the creator of each one in your own code.
  3. Count, sort and keep the top ten yourself.

With SQL here

SELECT creator, count(*) AS n
FROM entities
GROUP BY creator
ORDER BY n DESC
LIMIT 10

Runs in milliseconds in your tab. It is the Top 10 creators chart on a featured dashboard.

SQL also fixes a trust problem. Attributes are written by whoever creates an entity, so anyone can create one with project = arkiv-sql-indexer-dash. $creator is set by the chain. The app reads its own entities by creator (the app wallet), so look alike entities never count as its own.

SPECS.md, packages/core/src/query.ts, apps/web/lib/dash/sql.ts

Who this protects

The project enters two tracks, Open Source and Security. For each one: who is stuck or misled today, and what changes for them from the first day.

Open Source

Who
Arkiv app teams, analysts and AI agents who need GROUP BY or JOIN over Arkiv data.
Today
They page arkiv_query 200 rows at a time on a metered anonymous budget (on 18 October its header reported 10,000 cost units an hour, and one broad query used it up) and count in their own code, or they write their own indexer from eth_getLogs.
What changes
From day one: a documented data contract (manifest, delta, two Parquet files with fixed columns), an MIT indexer that runs without an API key, and hosted files that DuckDB or Python read without asking anyone. This app reads only that contract. On 20 October an analyst with only the DuckDB CLI 1.5.5 ran examples/top-creators.sh against the hosted index and had the ten top creators in 3.0 seconds, with no API key and no RPC call.
README.md, arkiv/schema.md, arkiv/friction.md, examples/top-creators.sh, apps/indexer/test/keyless.test.ts

Security

Who
A viewer of a Featured dashboard, and a widget author.
Today
Anyone can create a dashboard with project = arkiv-sql-indexer-dash, user set to the app wallet, login = arkiv and the slug of a Featured dashboard. An app that trusted attributes would show it as Featured and run its SQL in your tab. A transferred, editable widget could have its author rewritten.
What changes
Every read filters on the chain set $creator, and Featured also needs $owner to be the app wallet. Decoders recheck the creator, an address is shown next to every Featured chip (the user attribute on dashboards, the chain's $owner on widget cards and widget pages; for Featured both are always the app wallet), and user widgets are readonly so no new owner can rewrite the author.
apps/web/lib/dash/entities.ts, apps/web/lib/dash/official.ts, apps/web/lib/dash/sql.ts, apps/web/lib/dash/schema.ts

Check the Security claim yourself: the query project = str('arkiv-sql-indexer-dash') AND NOT ($creator = addr(0x1f61c3cac1612c020f64739b128c5f198939c8cd)) returned no entities on 20 October 2026. Anything it ever returns is ignored by this app.

Why Arkiv

Arkiv moves the trust point from a database operator to the public chain. With an ordinary database you trust whoever runs it to say which rows exist, who wrote them and when they expire. Here those facts are chain state: the chain sets $creator and $owner, enforces the expiry block, and logs every create, patch, extend, transfer and delete publicly.

  • CompletenessAnyone can replay the public logs from block zero without an API key, or run the MIT indexer, and compare the result with the hosted files.
  • FreshnessVerify rereads rows from an RPC node. Anyone can choose the RPC endpoint, self host this app, or run their own node.
  • Still trustedVerify trusts the RPC node it asks, since eth_getProof is not available. Choosing your own node moves that trust to a party you pick; it does not remove it.
Instead of ArkivWhat breaks
Postgres run by an operatorThe operator decides which rows exist. It can keep a row after its expiry, write rows under any author and drop rows, and readers cannot check. Here the chain sets $creator and the expiry block, and Verify rereads any row from an RPC node.
IPFSBlobs by content hash: no typed attributes to filter on, no expiry, no owner who can transfer or delete, no query. Widget lifetimes, extension by anyone and transfer to the author would all disappear.
A subgraphNo expiry semantics: a row lives until a mapping removes it, so widget lifetimes would be app code nobody can check. Every schema change means a new mapping and a redeploy. Readers trust whoever hosts it. This indexer works for any entity and any attributes with no redeploy, expiry comes from the chain, and Verify rechecks any row against an RPC node.
Our own APIA server we run that answers queries. Readers could not recompute its answers, so they would trust us to report rows faithfully. This project publishes plain files instead, which anyone can rebuild from public logs and compare.

What stays off Arkiv on purpose

Kept off chainWhy
Parquet snapshots, delta and manifestDerived data that anyone can rebuild by replaying public logs. A cache, not a record.
DuckDBComputation, not data. SQL runs in your tab and never on a server.
Session cookies, login nonces, rate limitsShort lived state of one web server. On chain they would be public and outlive their purpose.
Payload copiesPayloads stay on chain and load on demand. The indexer never copies them into Parquet.
The API keyA secret, kept in the server runtime only. A test checks that no build or browser file names it.
Email, handles, Privy IDsPersonal data. Only the wallet address and the login provider name are written.
README.md, test/deployment.test.ts, apps/indexer/src/snapshot.ts

Architecture

The indexer turns the chain into files. The browser turns the files into a database and keeps it current.

  1. Arkiv RPCPublic logs and keyed lookups.
  2. Bun indexerWrites Parquet and a delta.
  3. Next.js proxyServes them at /data.
  4. DuckDB WASMRuns your SQL in the tab.
Indexer
Scans latest state in key order with pages of at most 100 entities. Attributes are filled newest first with $key lookups of at most 50 keys. Rabdi retains roughly 1,000 blocks of logs; the indexer rebuilds when it falls behind that window. Live sync applies creates, patches, extensions, transfers and deletes every 5 blocks.
Snapshot, delta, live tail
A new versioned pair of Parquet files every 30 blocks, keeping the latest two. A JSON delta carries every key changed since that snapshot, and the browser polls it every 2 seconds. Between deltas, the browser tails chain logs every 4 seconds and fetches attributes for new keys at most every 20 seconds.
DuckDB WASM
Merges the three sources into two views, entities and attributes. Every query runs in your tab; there is no server SQL endpoint.
/data proxy
Next.js forwards manifest, delta and Parquet requests to INDEXER_URL (the hosted indexer for this app, or your own), with ETags and Range support. If the indexer is down, it serves the same files from a read only mount.
Polling, not events
The indexer and the browser poll eth_getLogs directly instead of using the SDK event watcher. That gives explicit block windows and checkpoints: the indexer commits one per batch, and the browser tail starts at delta.toBlock + 1, exactly where the indexer's published window ends.
/api/rpc proxy
Browser reads (live head, logs, payloads, verify) go through this same origin proxy. It allows read only methods, limits each client to 10 requests a second, and adds the server's API key when one is configured. No key ever reaches the browser.
apps/indexer/src/replay.ts, apps/indexer/src/fill.ts, apps/indexer/src/sync.ts, apps/indexer/src/config.ts, apps/web/lib/proxy.ts, apps/web/lib/live-tail.ts, apps/web/app/api/rpc/route.ts

Run your own indexer

The indexer is the reusable part. Point it at all of Arkiv, or at a subset with INDEX_EXPRESSION (for example $creator = addr(…)), and it publishes a manifest, snapshots and a delta that any app, script or agent can read.

git clone https://github.com/SlayerAnsh/hackathon-duckdb-indexer.git sql-indexer
cd sql-indexer
cp .env.example .env
docker compose -f docker-compose.yml -f docker-compose.local.yml up -d --build
  • No API keyBackfill and live sync read public logs. The key is used only when you opt in.
  • Plain filesRead manifest.json, then the Parquet files it lists, with DuckDB or any Parquet tool.
  • Docker or BunDocker Compose for the full stack, or Bun 1.3 to run the indexer and the app directly.

The hosted indexer behind this app serves the same files at arkiv-sql-indexer.dokploy.anshudhar.dev, so you can query all of Rabdi with DuckDB without running anything.

Full setup in the README

README.md, docker-compose.yml, .env.example, apps/indexer/test/keyless.test.ts

Entity model

The app writes three entity types, each with the attribute project = arkiv-sql-indexer-dash. Attributes are typed and queryable. The JSON payload holds the details, stays on chain, and never enters Parquet; the Payload button loads it on demand.

widget

Attributes
type, project, user (addr), login, name, chart
Payload
SQL, chart mapping, number format, chosen lifetime
Lifetime
1, 7, 30 or 90 days

dashboard

Attributes
type, project, user (addr), login, title
Payload
Title and description
Lifetime
90 days, renewed on each organize save

link

Attributes
type, project, user (addr), dashboard (key), widget (key)
Payload
Size, position and a copy of the widget name
Lifetime
Follows its dashboard

A dashboard holds at most 48 links and never the same widget twice. The login attribute records only the provider name; no email, handle or Privy user ID is written.

arkiv/schema.md, apps/web/lib/dash/schema.ts

Who owns what

You log in with Privy (Google, Discord, X or Telegram) and get an embedded wallet. The app wallet creates every entity, so $creator stays one known address. A widget is then handed to you.

  1. SaveThe app wallet creates the widget. Saving is free.
  2. Transferred to youIn the same transaction it moves to your wallet.
  3. Extend, transfer or deleteSigned in your browser and paid in tGLM. Anyone logged in may extend it.
  4. ExpiresAfter its lifetime ends, unless someone extends it.
ActionWho can do itHow
Save a widgetAny logged in userThrough the app, free.
Edit a widgetIts Arkiv ownerThrough the app, free. Saves a new version and repoints your dashboard links.
Extend a widgetAny logged in userSigned in the browser, paid in tGLM. Adds its lifetime again, up to 90 days ahead.
Delete or transfer a widgetIts Arkiv ownerSigned in the browser, paid in tGLM.
Edit a dashboardIts owner (the user attribute)Through the app. Dashboards and links stay owned by the app wallet.
Why readonly
Once a widget is yours the app no longer controls it, so its attributes and payload are frozen for life. A new owner cannot rewrite the author, or set it to the app wallet and hand it back to fake a Featured widget. That is also why editing saves a new version.
Why anyone can extend
A widget on someone else's dashboard may matter to you. Permissionless extension lets you keep it alive, paying your own fee, without being able to change it.
Why one transaction
Saving creates the widget and transfers it to you in one batch, with its key predicted in advance. Either both happen or neither, so a widget is never left with the app wallet, and a new placement never points at a widget that failed to save. Organize saves a whole layout the same way.

Featured dashboards and widgets belong to the app wallet itself: it is both their user and their Arkiv owner. The server extends them on a schedule, so they stay live.

arkiv/schema.md, apps/web/lib/dash/server/operations.ts, apps/web/lib/dash/server/keepalive.ts

Expiry and lifetimes

Every Arkiv entity has an expiry block. The index honours it instead of keeping data forever, in three places:

  • Snapshot buildCopies only rows with expires_at above the head.
  • Indexer sweepDeletes expired rows every batch and keeps only two snapshot versions.
  • Browser viewsHide rows whose expiry is at or below live_head, read from the RPC.

So a row leaves SQL the moment its block passes, with no event needed. Extending a widget adds its chosen lifetime again, capped at 90 days remaining.

EntityLifetimeWhy
Widget1, 7, 30 or 90 days, your choiceYou decide how long a public query stays public. Each extend adds that lifetime again, so it lives while someone keeps renewing it. The 90 day cap is an app rule, not an Arkiv limit.
Dashboard90 days, renewed on every saveEditing a dashboard is the activity that keeps it alive.
LinkSame expiry as its dashboardA placement never outlives its dashboard or dies before it.
Featured90 days, kept alive by the appA lease: every 6 hours the app wallet checks Featured entities and extends any with fewer than 30 days left back to 90. The first renewal falls due about 60 days after creation.

When a widget expires or is deleted, its dashboard slot keeps the copied name and runs no SQL.

An older snapshot file can hold a row until it is pruned, and someone who copied data while it was live keeps their copy. Expiry here is not a promise to erase third party copies.

apps/indexer/src/snapshot.ts, apps/indexer/src/store.ts, packages/core/src/views.ts

Verify a row

When a result has a key column, Verify (or Verify page for every row) asks the RPC for each key's current update block, expiry and owner, in batches of 50, and compares them with your copy:

ok
The chain has the same last update and expiry as your copy.
extended
The chain holds a newer update with a later expiry.
stale
The chain holds a different version than your copy.
expired
The expiry block on chain is at or below the live head.
deleted
The RPC no longer returns the entity. This cannot tell deletion from expiry.

This is a consistency check against the RPC, not a cryptographic proof, because eth_getProof is not available on Arkiv.

The chain is the reference, not the index. To see a stale copy caught, start an indexer with SYNC_PAUSED=true on an old data directory and run examples/verify_against_chain.py against it: it applies the same rule to the 50 newest rows. Recorded on 20 October 2026 at 01:58 UTC: a copy paused at block 757,400, 48,478 blocks behind, came back 45 deleted and 5 extended; the live hosted index, at snapshot block 805,871 with the chain head at 805,881, came back 50 ok. That second result drifts with live churn: about 2,800 keys change per hour, so a rerun can show a few stale or extended rows updated since the last snapshot. In this app the browser live tail replays chain logs on top of a paused index, so here a stale copy shows only until the tail catches up.

apps/web/lib/verify.ts, apps/web/components/dash/ResultsGrid.tsx, examples/verify_against_chain.py, apps/web/test/helpers.test.ts

Reproduce it

  1. Open a featured dashboard. Every chart is one SQL query run by DuckDB in your tab, with its SQL one click away.
  2. Open the playground and run “Most placed widgets”. It joins widget and link entities and counts placements, including widgets with none.
  3. Run SELECT key, creator, owner, updated_at, expires_at FROM entities LIMIT 20 and press Verify page. Each row is checked against the chain.
  4. Watch a row expire. Sort by expires_at, wait for the chain block in the status bar to pass one, and run again. The row is gone.
  5. Look up the app wallet. It is the creator of every app entity; see On chain evidence.
README.md, apps/web/lib/views.ts, apps/web/components/dash/StatusBar.tsx

On chain evidence

Every value below was read back from Tiramisu on 20 October 2026. Each creation transaction was sent by the app wallet and stays on the explorer after the entity expires.

App wallet, creator of every widget, dashboard and link
0x1f61c3cac1612c020f64739b128c5f198939c8cd
A user owned widget, readonly and permissionlessly extendable, created and transferred in one transaction
0x78ca2e9ea9f292bc81a6356a89d7e73eddb6f491916209d673b6ec724b22be23created in 0xa3668515f09911d190336e92457afba8759f79f3f18870e7d5a33f7cd7a21f03
Its owner, a Privy embedded wallet
0x2f4d9088ff069c17c2ae6c051e3c78911b827757
README.md, arkiv/schema.md

Limits and trust

  • Completeness. Verify checks the rows you see. It cannot show a row the indexer left out; for that, run your own indexer and compare.
  • The read proxy. Browser RPC reads go through this server's /api/rpc. You trust it to forward them unchanged, or you self host.
  • Filtered indexes. With an INDEX_EXPRESSION that has no $creator or $owner term, keyless sync cannot see an existing entity that starts matching through a patch.
  • One web instance. Login nonces, rate limits and the app wallet queue live in memory.
  • Everything is public. SQL, names and dashboard content are on chain. Keep personal information out of them.

Friction we measured

On Tiramisu between 18 and 20 October 2026 with SDK 0.8.1, viem 2.57.7 and Privy 3.50.0. Expected and actual behavior, versions and reproduction steps are in arkiv/friction.md.

  • Anonymous budget and its 429limit=10000 on 18 October, gone in one query

    On 18 October the RateLimit header of an anonymous arkiv_query reported 10,000 cost units, reset after about an hour, and a broad $expiresAt > u64(0) query with limit 5 used all of it. Later calls returned HTTP 429 with a plain object, not a JSON RPC error envelope. The Arkiv docs give no anonymous number, and on 20 October the header reports limit=600, reset=60, a count of requests per minute, so the cost budget left is no longer visible. The client handles both error shapes and waits for Retry-After.

  • Undocumented query length limit50 key terms pass, 100 fail

    An OR of 50 keys (about 4,100 characters) worked; 100 keys (about 8,200) failed with -32004 query is too long, and the failure still cost units. Lookups are chunked at 50.

  • Flat cost per callArkiv-Cost: 100

    One key, 50 keys, a full 200 row page and a failing call all showed the same cost. Batching keys is the only lever, so every lookup carries up to 50.

  • Monthly quota is a percentageno capacity or remaining units

    Headers expose quota used as a percent, so remaining calls cannot be computed. Together with the measured change rate, this is why the indexer runs without an API key by default.

  • Create and transfer in one batchworked, block 803,198

    The docs show ownershipChanges only for existing keys. A create with a salt from predictEntityKeys plus a transfer of that key in the same executeBatch works: one transaction logs EntityCreated, then OwnershipTransferred. Prediction and send share one slot of a serial queue.

  • Wallet transport retries4 sends instead of 1

    A viem custom transport retries 3 times by default, including eth_sendTransaction, on codes such as -32603. With Privy signing silently that would resend a write. The wallet transport sets retryCount: 0; a probe confirmed 4 provider calls before and 1 after.

  • Extend at the capExpiryNotExtended

    An extend sets an absolute expiry and reverts when it is not later. Anyone may extend a user widget, so two viewers can race. The app computes the target from a fresh head, refuses to send at the 90 day cap, and maps the revert to the same message.

  • Anonymous budget, againANON_COST_LIMITED on 20 October

    Browser reads went straight to the public RPC on each visitor's own budget and hit HTTP 429. They now go through the same origin /api/rpc proxy, which adds the server's API key, and the UI shows a budget notice instead of retrying.

  • Keyless attribute backlog809 of 36,457 pending

    Without a key, attributes fill at up to 50 keys per query on the anonymous budget, newest first, while about 2,800 keys change per hour. The hosted indexer converges; rows stay queryable from log data while attributes load.

arkiv/friction.md, README.md