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
| Application | Description | Components |
|---|---|---|
| Shielded Pool | Private asset transfers | Circom + PolkaVM + LeanIMT |
| ZK Identity | Anonymous credentials | Poseidon + Groth16 |
| Private DEX | Hidden order books | SNARKs + Asset Hub |
| ZK Bridge | Cross-chain privacy | XCM + 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.
| Parameter | Value |
|---|---|
| Chain ID | 420420422 |
| RPC Endpoint | https://testnet-passet-hub-eth-rpc.polkadot.io |
| Block Explorer | https://blockscout-passet-hub.parity-testnet.parity.io/ |
| Faucet | https://faucet.polkadot.io/?parachain=1111 |
| Token | PAS (Paseo) |
| website | https://paseo.site/ |
Getting Started
-
Set up development environment
- Install Rust and PolkaVM toolchain
- Install Node.js and snarkJS
- Install Circom compiler
-
Write your first circuit
- Start with simple arithmetic circuits
- Generate test witnesses
- Create proofs locally
-
Deploy verifier contract
- Use snarkJS to generate Solidity verifier
- Deploy to Paseo Asset Hub
- Test with generated proofs
-
Build full application
- Add Merkle tree for state
- Implement deposit/withdraw logic
- Create frontend for users
Next Steps
- PolkaVM Smart Contracts - Write ZK-friendly contracts
- Poseidon Hash - Implement efficient hashing
- Asset Hub Integration - Deploy on Kusama
- Shielded Pools - Build privacy applications
- Circom Guide - Design circuits
- Deployment - Deploy to testnet
Previous: Blockchain and Cryptocurrencies | Next: PolkaVM Smart Contracts