Private PQ Messaging

Post-quantum private messaging on Ethereum: Kyber512 + ZK proofs, sender and recipient hidden.

Private PQ Messaging

Created At

ETHGlobal Mumbai

Project Description

pq is post-quantum private messaging for Web3 payments, private coordination and transaction negotiation. Messages are stored publicly on-chain, yet only the two ends of a conversation can read them, and the chain never shows who is talking to whom.

The problem: today's encrypted messaging relies on elliptic-curve cryptography (ECDH), which is exposed to "harvest now, decrypt later" quantum attacks. Anything on a public chain is stored forever, so it's harvested by default.

How it works:

  1. Join: create a passkey. It derives your Sender Key and a Kyber512 (lattice-based, post-quantum) User Key, which your wallet registers.
  2. Open a Channel: your browser encrypts a Channel Key to the recipient's Kyber512 key and proves in zero knowledge that the encryption is well formed, without revealing who the recipient is.
  3. Send: each message is encrypted with its own Message Key and stored under a Message ID that only the two ends can compute.
  4. Read: recipients find Channels opened to them by trial-decryption, then read messages by ID.

Bulky post-quantum data (800-byte User Keys, Encrypted Channel Keys) lives on Arkiv, with only keccak256 hashes on Ethereum, cutting gas by 83-88%. A Fixed Sender relays every transaction, so on-chain you only see it calling the contract. Live on Sepolia; an unaudited research prototype.

How it's Made

A Scaffold-ETH 2 monorepo with three packages:

  • Circuits (Go + gnark): Kyber512 CPA-PKE, via our fork of Cloudflare's CIRCL that exposes Kyber's polynomial math, plus a Groth16 circuit on BN254 proving the Encrypted Channel Key is a valid Kyber encryption of a key matching its public hash. The recipient's key is a private input, so the recipient stays hidden. ~49k constraints, 384-byte proof. Every hash is Poseidon2.
  • Browser prover: the same Go code compiled to WASM, so hashing and Kyber have one implementation across native, circuit and browser. Proving takes ~8s on CPU, with gnark's WebGPU runtime taking over where available.
  • Contracts (Solidity, Foundry): PqMsg registers Users, opens Channels after checking the opening proof with the gnark-generated Verifier.sol, and stores messages. Deployed on Sepolia.
  • Storage on Arkiv: post-quantum keys are big, so User Keys and Channels are stored whole as Arkiv entities (Rabdi testnet), and PqMsg keeps only their keccak256 hashes. Readers drop any entity that doesn't match its on-chain hash, so Arkiv needs no trust. This cut register from 3.02M to 0.36M gas (-88%) and openChannel from 5.01M to 0.83M (-83%).
  • Frontend (Next.js, React, TypeScript, wagmi/viem): passkey (WebAuthn PRF) key derivation, the chat UI, and a "Deep dive" mode that explains each crypto step as it runs and links new Arkiv entities. A server-side Fixed Sender submits transactions and writes to Arkiv so users stay unlinkable; the browser reads Arkiv directly and fetches recipient keys over Anon-RPC.

Notably hacky: leaving Kyber ciphertext uncompressed so the circuit can check it, packing 768 coefficients into 37 field elements, and a 2^64 domain tag for key separation.

background image mobile

Join the mailing list

Get the latest news and updates

Private PQ Messaging | ETHGlobal