Ghostwitness

Film it, lose the phone, keep the video: nearby phones carry encrypted shards to Swarm and Arkiv.

Ghostwitness

Created At

ETHGlobal Mumbai

Project Description

GhostWitness is an Android app for filming something someone may try to stop you from keeping: a police stop, a protest, harassment at work.

While you record, the app cuts the video into 2-second segments, encrypts each one on your phone and splits it into 5 Reed-Solomon shards, any 3 of which rebuild it. It hands the shards to phones nearby over Google Nearby, which works with no internet. Those witness phones never see the video. As soon as they get a connection they upload their shards to Swarm and write a small index entry on Arkiv: which recording, which segment and shard, the Swarm reference and a hash. Every entry is owned by the recorder's wallet.

If your phone is grabbed, smashed or wiped, the recording has already left it. Sign in with the same wallet on any other phone: GhostWitness finds your recordings on Arkiv, fetches 3 shards per segment from Swarm, checks every hash and signature, decrypts and plays the video. Each segment is signed and chained to the one before, so a cut or edited recording is detected.

There is no GhostWitness server in the upload path. Witnesses write straight to Swarm and Arkiv with their own device keys. An optional rewards contract on Base Sepolia pays witnesses for each shard they can prove they stored.

How it's Made

Kotlin, in two modules.

core is plain JVM code with no Android dependency, so all of it runs in unit tests. It holds AES-256-GCM segment encryption (session id, segment index, start time and the previous ciphertext hash go in the AAD, which chains the segments), a GF(256) Reed-Solomon 3-of-5 codec, Merkle commitments with a signed root per segment, and X25519 HPKE for wrapping keys. There is no JVM SDK for Arkiv, so we wrote our own secp256k1 signing, RLP, EIP-1559 transactions and ABI encoding, and checked the Arkiv create-and-transfer calldata against test vectors generated with viem.

app records with Camera2, MediaCodec and AudioRecord. It moves shards between phones with Google Nearby Connections and uploads from an Android JobService, so uploads keep going after the app is closed. Each witness phone has its own writer key, stored encrypted with Android Keystore. For each shard it POSTs the bytes to a Swarm Bee node (/bytes), reads them back and compares, then sends an Arkiv transaction that creates the entity and transfers it to the recorder's wallet. It waits for the receipt (Arkiv blocks are about 2 s) and reads the entity back to check every attribute. Recovery queries Arkiv by $owner, app, kind and session id, pulls shards from Swarm and rebuilds the segments.

Owners sign in with MetaMask over Reown WalletConnect. The wallet signs an ownership proof (GWO1) that is stored on the session entity. A small Node key service (ethers, HPKE) releases a recording's content key only to the wallet that proved ownership.

Rewards: a Solidity contract compiled with solc and deployed with ethers on Base Sepolia. The owner funds it by sending ETH from their wallet, with no form or setup. Each verified shard of any of their recordings is paid from that deposit, and the verifier only pays for a recording whose wallet-signed ownership proof is on Arkiv. The verifier also checks the Arkiv entity and the Swarm bytes before it signs a claim.

For the demo we ran our own Bee 2.8.3 light node on the Swarm Sepolia testnet in Docker. The hacky part: the Bee API puts wallet, stamp and chequebook routes on the same port as data, so we wrote a small allow-list proxy. Uploads need a secret path and our postage batch; public reads are limited to GET /bytes/<ref>. Phones reach it through a Cloudflare tunnel.

background image mobile

Join the mailing list

Get the latest news and updates

Ghostwitness | ETHGlobal