Chromia
Start Building

04 / 19Advanced

Architecture overview

What is the demo dapp?

This ZKP demo is a Chromia application that shows you how to build confidential transactions with zero-knowledge proofs. It demonstrates a privacy-preserving token system. It runs two token forms side by side, public and private. You can switch your balance between them, and your transactions stay private.

Core concept

Privacy here rests on a UTXO-based privacy model with these parts:

  • Public tokens are FT4 tokens, and anyone can see them on chain.
  • Private tokens are cryptographic commitments whose amounts stay hidden.
  • Shield operations turn your public tokens into private commitments.
  • Private transfers send private tokens from one user to another anonymously.
  • Unshield operations turn private tokens back into public ones.

Together, these operations add a confidential transaction layer above the Chromia blockchain. For each transaction, you decide whether it is public or private.

Technical architecture

Multi-layer architecture

Three closely connected layers make up the dapp:

1. Circom zero-knowledge circuits

Technology stack: Circom, the PLONK proof system, and Groth16 as a fallback

Key features:

  • PLONK proofs keep verification efficient.
  • Poseidon hashing supplies cryptography suited to circuits.
  • Nullifier generation stops the same note from being spent twice.
  • Commitment schemes conceal token amounts.

2. Rell dapp (blockchain layer)

Technology stack: Rell, Chromia Postchain, FT4 Framework, ZKPGTXModule

Security features

  • ZKP verification: ZKPGTXModule checks every private operation.
  • Double-spending prevention: the chain records nullifiers and rejects reused ones.
  • Input validation: a commitment can be spent only if it is valid.
  • State consistency: the UTXO sets are kept accurate.

3. Next.js client (frontend layer)

Technology stack: Next.js, React, TypeScript, MetaMask integration, and the Chromia FT4Client

Key features:

  • SecureNoteManager handles keys and encrypts notes on the client side.
  • FT4Client integration connects the frontend to the blockchain.
  • MetaMask wallet connection authenticates users and signs their transactions.
  • ZKP proof generation happens in your browser through WebAssembly circuits.
  • Private key derivation builds the note-decryption key from a wallet signature.
  • A straightforward UI lets you shield, unshield, and transfer privately.
Written for this site from Chromia’s public course. Code samples are the course’s own.