Decentralized, access-controlled communication with post-quantum encryption and zero-knowledge membership proofs.
Decomm is a production-grade prototype for private group communication. Peers discover each other over a libp2p GossipSub mesh, establish post-quantum forward secrecy via Kyber1024, encrypt messages with ChaCha20-Poly1305 AEAD, and prove authorized membership using a RISC Zero STARK proof—without revealing their secret identity or allowlist pre-image.
The global membership allowlist is anchored on Solana Devnet via an Anchor program. Peers dynamically fetch and verify the on-chain Merkle root, accepting communication only from peers presenting valid, unreplayable zero-knowledge proofs.
Decomm has undergone an independent security review documented in AUDIT.md. All findings (D-01 through D-08) have been remediated, verified, and hardened:
- D-01 (High) — Proof Replay & Identity Theft Defense: The RISC Zero guest circuit binds
(topic, root, sender_peer_id)directly into the public journal. The receiving peer cryptographically validates that the receipt journal's peer ID matches the libp2p sender, preventing proof eavesdropping and replay attacks. - D-02 (High) — Second-Preimage Defense via Domain Separation: Merkle tree hashing uses strict domain prefixes (
0x00for leaf hashes,0x01for internal node hashes) to prevent leaf-node collision and second-preimage attacks. - D-04 (Medium) — Cryptographic Key Derivation: Replaced raw KEM slicing with HKDF-SHA256 key derivation. The derivation binds both peer IDs and the encapsulated ciphertext into the session key material.
- D-05 (Low) — Deterministic Networking: Added
--portCLI argument and explicit local listen address logging for predictable multiaddr dialing and firewall traversal. - D-06 (Low) — Deterministic Build Reproducibility: Tracked
Cargo.lockfiles across workspace packages for verifiable dependencies and dependency vulnerability scanning. - D-07 (Low) — Solana Program Ownership Verification: The on-chain state fetcher strictly verifies that the
NetworkStateaccount is owned by the expected AlterBlock Anchor program ID, preventing spoofed rogue account attacks. - D-08 (Low) — Monotonic Sequence & Replay Rejection: ChaCha20-Poly1305 AEAD incorporates strictly monotonic 64-bit sequence numbering and sender peer ID in the Additional Authenticated Data (AAD), rejecting message reordering, duplication, and reflection attacks.
- Decentralized P2P Networking — Built on
libp2p0.56 with TCP transport, Noise authentication, Yamux multiplexing, and cryptographically signed GossipSub mesh. - Post-Quantum Cryptography (PQC) — Kyber1024 key encapsulation mechanism (KEM) resistant to retrospective store-now-decrypt-later attacks by quantum adversaries.
- Authenticated Symmetric Encryption — ChaCha20-Poly1305 AEAD with unique 96-bit nonces, 64-bit sequence counters, and peer ID binding in AAD.
- Zero-Knowledge Membership (ZKP) — RISC Zero zkVM guest circuit proves private secret inclusion in a 4-leaf Merkle tree without revealing secret pre-images.
- On-Chain Anchor State — Solana smart contract manages authorized Merkle roots with admin-gated rotation instructions.
- Pure-System Execution — Runs with
disable-dev-modestrictly enforced; all proofs are genuine cryptographic STARKs.
Solana Devnet
AlterBlock NetworkState Account
(PDA / Program-Owned Account)
│ Current Merkle Root
▼
┌─────────────────────────────────────────────────────────────┐
│ Decomm Node │
│ │
│ 1. Fetch & verify on-chain Merkle root │
│ 2. Libp2p GossipSub Discovery ─── TCP Handshake │
│ 3. Kyber1024 KEM ─── HKDF-SHA256 ─── Shared Session Key │
│ 4. RISC Zero zkVM ── STARK Prover ── ZK Visa Generation │
│ 5. GossipSub zk-auth-plane ───────── ZK Visa Verification │
│ 6. Unlocked Session ──────────────── ChaCha20-Poly1305 E2EE│
└─────────────────────────────────────────────────────────────┘
- State Initialization: The node queries Solana Devnet for the
NetworkStateaccount and cryptographically verifies its program owner. - KEM Exchange: Upon discovering a peer on the GossipSub mesh, nodes determine role (Initiator / Responder) by comparing peer IDs. Initiator sends its Kyber1024 public key; Responder encapsulates and returns the ciphertext. Both derive identical 256-bit symmetric keys via HKDF-SHA256.
- ZK Visa Proving: In the background, each node executes the RISC Zero guest method with its private secret and Merkle path, producing a STARK receipt binding its Peer ID, the topic, and the on-chain Merkle root.
- Visa Verification: Nodes broadcast their ZK Visas across the
zk-auth-planetopic. Receiving peers verify the receipt againstMETHOD_ID, ensure the journal matches the sender's Peer ID, and confirm the root matches current on-chain state. - Secure Encrypted Chat: Once mutual verification succeeds, the chat plane unlocks. Messages are encrypted with ChaCha20-Poly1305 using monotonic sequence numbers.
| Directory | Purpose |
|---|---|
host/ |
Main Rust node binary (p2p-chat), libp2p swarm, cryptographic handshake, and CLI interface. |
host/src/bin/update_root.rs |
Admin utility to compute domain-separated Merkle roots and submit update transactions to Solana. |
methods/guest/ |
RISC Zero guest zkVM circuit verifying Merkle inclusion and committing public inputs. |
methods/ |
Build script and compilation wrapper embedding the guest ELF and METHOD_ID. |
alterblock_contracts/ |
Solana Anchor program (alterblock_contracts) managing on-chain Merkle roots. |
alterblock_contracts/tests/ |
TypeScript Mocha test suite verifying contract initialization, updates, and unauthorized rejection. |
AUDIT.md |
Security audit report and remediation details. |
- Rust: Version 1.89+ (the host uses Rust edition 2024; run
rustup update stable). - Memory / Swap: Generating real STARK proofs on CPU utilizes multi-threaded polynomial calculations. Having 8 GB+ of virtual memory (RAM + swap) is recommended (e.g., configure a 4 GB swapfile on WSL2).
- Solana CLI & Anchor (optional, for contract development): Solana CLI v2.0+ and Anchor v0.32+.
git clone https://github.com/jbhavya876/decomm.git
cd decomm
cargo build -p p2p-chatOpen two separate terminal windows:
cargo run -p p2p-chat -- --port 50001Node 1 outputs its listen multiaddress, e.g.:
📡 Node listening on: /ip4/127.0.0.1/tcp/50001
cargo run -p p2p-chat -- --port 50002 --dial /ip4/127.0.0.1/tcp/50001/p2p/<NODE_1_PEER_ID>Once connected, both nodes execute Kyber KEM and compute their STARK proof:
🔗 Mesh linked! I am KEM Initiator. Broadcasting Kyber Public Key...
🔄 Received Kyber Ciphertext... Decapsulating...
⏳ Background Prover: Fetching fresh Solana state & generating ZK Visa...
✅ Background Prover: ZK Visa generated successfully.
📤 Broadcasted ZK Visa to the mesh network.
✅ ZK Visa accepted! Peer ... is fully authorized.
Type any message in either terminal and press Enter to chat over the post-quantum encrypted channel:
[🔒 Verified & PQC E2EE | 12D3KooW...]: Hello from Node 1 over quantum-resistant ZK channel!
| Variable | Default Value | Description |
|---|---|---|
SOLANA_RPC_URL |
https://api.devnet.solana.com |
Solana JSON-RPC endpoint (supports devnet or local test validator). |
DECOMM_MEMBER_SECRET |
alterblock-zk-secret |
Private member secret pre-image used to construct the Merkle path. |
DECOMM_STATE_PUBKEY |
F2vD6mCsHB18wbFqNYnwcRZTzV1K2i9eziTet4Tk6kg9 |
Base58 address of the on-chain NetworkState account. |
DECOMM_PROGRAM_ID |
8P5tdCSpXPev51dhXRX7w7U7GvFSTc7Jfbt3c6UxyMhG |
Base58 Program ID of the Anchor contract for ownership verification. |
SOLANA_KEYPAIR_PATH |
~/.config/solana/id.json |
Path to Solana wallet keypair (used by update_root). |
Executes all 10 unit tests covering domain separation, Merkle path resolution, AEAD tampering detection, sequence numbering replay guards, and wrong-peer AAD rejections:
cargo test -p p2p-chatTo run the live on-chain root query test against Solana:
SOLANA_RPC_URL=https://api.devnet.solana.com cargo test -p p2p-chat -- --ignoredcd alterblock_contracts
anchor testVerifies:
initialize— Creates theNetworkStateaccount with the domain-separated genesis Merkle root.update_root(authorized) — Allows the recorded admin authority to rotate the Merkle root.update_root(unauthorized) — Strictly rejects updates from non-admin signers.
To calculate and deploy a new Merkle root for a custom member secret:
DECOMM_MEMBER_SECRET="my-custom-secret" cargo run -p p2p-chat --bin update_rootDecomm is licensed under the MIT License.