Skip to content
Tunnel

Tunnel

Arkiv through firewalls and offline

Created on 18th October 2026

•

Tunnel

Tunnel

Arkiv through firewalls and offline

The problem Tunnel solves

"Read it from Arkiv, not from our backend" fails for two groups of people:

  1. People whose network blocks the Arkiv RPC domain: national firewalls, campus and office filters, carriers. Block one domain and every Arkiv app goes dark, however decentralised the data is.
  2. People with no connection at all: shutdowns, disasters, SMS-only phones. They can neither write to Arkiv nor check that a copy of Arkiv data someone hands them is genuine.

Tunnel is a viem transport plus tiny stateless relays. Change transport: http() to transport: tunnel(relays) in any Arkiv dApp, and every user of that app gets:

  • Writes through relays that can't alter them. The tx is signed on the device and sent to every relay at once (Cloudflare Workers and Vercel today). One honest, reachable relay is enough.
  • Reads that catch lying relays. The same query goes to several relays pinned to the same block (atBlock), and canonical result hashes are compared. The minority is flagged and dropped; with no majority, nothing is shown.
  • Offline writes. Sign with a pre-funded one-shot "stamp" in airplane mode and hand it over as a QR code, a file or 4 SMS. Any carrier can broadcast it, and $creator stays the author, never the carrier.
  • Offline reads. A certified copy is a snapshot at one block that independent witnesses re-read, sign and attest to on Arkiv. A single 64 KB HTML file verifies it with no network; change one byte and it turns red.
  • A relay registry that keeps itself honest. Relays are Arkiv entities with 2-hour leases, renewed hourly with extendEntity only while healthy. Dead relays disappear on their own.

Why not a VPN? It needs every user to install something, it is itself blocked or criminalised in places, and it does nothing offline.

Challenges I ran into

  • Offline signing with the real SDK. createEntity reads the head block before signing, which an offline device can't do. Reading the SDK source showed that ExpirationTime.fromDays(n) goes on the wire as a lifetime relative to the inclusion block, so the head is only a sanity check. We answer it locally in a no-network transport (the test asserts fetch is never called) and refuse absolute expiries. A notice carried three days later still lives its full 90 days.
  • Making relay answers comparable. Honest relays return entities and attributes in different orders, and the head moves between calls. We canonicalise the raw RPC results (sort by key and attribute name, lowercase hex, stable JSON) and pin atBlock for every relay.
  • Read-your-writes. Our first live write read back as empty, because reads were pinned 2 blocks behind the head, below the write. The transport now never pins below a block it has seen a receipt for.
  • Rate limits. The anonymous arkiv_query budget was already exhausted at our first query (HTTP 429 with a body that isn't JSON-RPC shaped), and it is per IP, which is exactly what a relay is. Relays now hold an Arkiv Hub key as a secret, and the client rotates on 429 using Retry-After.
  • SMS-sized transactions. A signed create is 2.3 KB of mostly ABI zero padding (17 SMS). Deflating it gets it to about 530 characters: 4 SMS, or one QR code.
  • Live registry updates. WebSocket entity events carry only keys, so spotting a new relay means re-querying after every create on the whole testnet (80 events in 70 s). We debounce, and filed it in friction.md with a suggested fix.

Tracks Applied (3)

Censorship Resistance

Access to Arkiv data itself: reading it, writing it, and proving a copy is genuine. Who is censored today: People on ne...Read More

Open Source

A tool any Arkiv team can adopt without asking anyone. Tunnel is an MIT library (packages/tunnel, publishable as arkiv-...Read More

Security

Trust never comes from a field anyone can write, or from an intermediary. Authorship is $creator, derived by the chain ...Read More

Discussion

Builders also viewed

See more projects on Devfolio