Zero Knowledge on Kusama

This section covers building zero-knowledge applications on the Kusama and Polkadot networks, with practical examples and deployment guides.

Why Kusama for ZK Applications?

Kusama provides a unique environment for zero-knowledge development:

  • PolkaVM: Efficient RISC-V based smart contracts with low gas costs
  • Asset Hub: Native support for private asset transfers
  • Cross-Chain Interoperability: Opt into all Polkadot infrastructure from Kusama, access countless permissionless integrations.
  • Lower Stakes: Cheap, fast and unstoppable transactions - ideal for experimentation

Architecture Overview

┌─────────────────────────────────────────────────────────────┐
│                    Kusama Network                            │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────┐  │
│  │  PolkaVM    │  │ Asset Hub   │  │  Other Parachains   │  │
│  │  Contracts  │  │  (ZK Pool)  │  │  (via XCM)          │  │
│  └─────────────┘  └─────────────┘  └─────────────────────┘  │
│         │                │                      │            │
│         └────────────────┼──────────────────────┘            │
│                          │                                   │
│              ┌───────────▼───────────┐                       │
│              │   ZK Verifier         │                       │
│              │   (Groth16/PLONK)     │                       │
│              └───────────────────────┘                       │
└─────────────────────────────────────────────────────────────┘
                           ▲
                           │
              ┌────────────┴────────────┐
              │   Off-chain Provers     │
              │   - Circom circuits     │
              │   - snarkJS proving     │
              │   - Merkle tree mgmt    │
              └─────────────────────────┘

Key Components

1. PolkaVM Contracts

PolkaVM is a RISC-V based virtual machine for Substrate:

  • Gas efficient: Lower costs than EVM for ZK verification
  • Rust native: Write contracts in Rust
  • ZK-friendly: Optimized for cryptographic operations

2. Poseidon Hash Function

Poseidon is the preferred hash function for ZK circuits:

  • SNARK-friendly: Designed for arithmetic circuits
  • BN254 curve: Compatible with Ethereum and Kusama
  • Gas efficient: Cheaper than Keccak/SHA in circuits

3. LeanIMT (Incremental Merkle Tree)

Efficient sparse Merkle tree for privacy pools:

  • Dynamic depth: Grows with insertions
  • Gas optimized: Minimal storage updates
  • zk-kit compatible: Standard implementation

Example Applications

ApplicationDescriptionComponents
Shielded PoolPrivate asset transfersCircom + PolkaVM + LeanIMT
ZK IdentityAnonymous credentialsPoseidon + Groth16
Private DEXHidden order booksSNARKs + Asset Hub
ZK BridgeCross-chain privacyXCM + Verifiers

Development Stack

┌─────────────────────────────────────────┐
│           Frontend (TypeScript)          │
│   - snarkJS for proof generation        │
│   - polkadot.js for chain interaction   │
└─────────────────────────────────────────┘
                    │
┌───────────────────▼───────────────────┐
│           ZK Circuits (Circom)         │
│   - Circuit design                    │
│   - Witness generation                │
│   - Proof creation                    │
└───────────────────────────────────────┘
                    │
┌───────────────────▼───────────────────┐
│        Smart Contracts (Rust/Solidity) │
│   - PolkaVM for verification          │
│   - Asset Hub for token management    │
└───────────────────────────────────────┘
                    │
┌───────────────────▼───────────────────┐
│           Kusama Network               │
│   - Paseo testnet                     │
│   - Asset Hub parachain               │
└───────────────────────────────────────┘

Testnet Information

Paseo Asset Hub

Paseo testnet is a stable relaychain testnet with multiple parachains connected to it. Making it the ideal place to test your applications.

ParameterValue
Chain ID420420422
RPC Endpointhttps://testnet-passet-hub-eth-rpc.polkadot.io
Block Explorerhttps://blockscout-passet-hub.parity-testnet.parity.io/
Faucethttps://faucet.polkadot.io/?parachain=1111
TokenPAS (Paseo)
websitehttps://paseo.site/

Getting Started

  1. Set up development environment

    • Install Rust and PolkaVM toolchain
    • Install Node.js and snarkJS
    • Install Circom compiler
  2. Write your first circuit

    • Start with simple arithmetic circuits
    • Generate test witnesses
    • Create proofs locally
  3. Deploy verifier contract

    • Use snarkJS to generate Solidity verifier
    • Deploy to Paseo Asset Hub
    • Test with generated proofs
  4. Build full application

    • Add Merkle tree for state
    • Implement deposit/withdraw logic
    • Create frontend for users

Next Steps


Previous: Blockchain and Cryptocurrencies | Next: PolkaVM Smart Contracts