Getting Started
Prerequisites
System Requirements:
- Node.js for website development
- Rust for mobile app compilation
- Git for version control
Circuit Development Tools:
- Circom
- snarkjs
- Noir/Nargo
App Development Tools:
- Mopro CLI
- Flutter
- Android Studio
Quick Start
1. Clone the Repository
git clone https://github.com/BlocSoc-iitr/Deimos.git
cd Deimos2. Explore the Website Dashboard
cd website
npm install
npm run devThe website will be available at http://localhost:3000
Working with Circom Circuits
Step 1: Compiling a Circuit
cd benchmarking-suite/frameworks/circom/circuits/sha256
circom circom.circom --r1cs --wasm --sym --c
Step 2: Computing the Witness
First, copy the input.json file from inputs/sha256/ to the appropriate directory:
- For WebAssembly:
circuits/sha256/circom_js/ - For C++:
circuits/sha256/circom_cpp/
Option 1: Computing Witness with WebAssembly
cd benchmarking-suite/frameworks/circom/circuits/sha256/circom_js/
node generate_witness.js circom.wasm input.json witness.wtnsOption 2: Computing Witness with C++
cd benchmarking-suite/frameworks/circom/circuits/sha256/circom_cpp/
make
./circom input.json witness.wtnsStep 3: Generating Proving Keys
3a. Powers of Tau Ceremony (Circuit-Independent)
The Powers of Tau ceremony is a one-time setup that doesn't depend on a specific circuit.
# Start new ceremony
snarkjs powersoftau new bn128 12 pot12_0000.ptau -v
# Contribute randomness
snarkjs powersoftau contribute pot12_0000.ptau pot12_0001.ptau --name="First contribution" -v3b. Generating zkey and verification key (Circuit-Dependent)
These steps are specific to your circuit and must be done for each circuit you compile.
# Prepare for phase 2
snarkjs powersoftau prepare phase2 pot12_0001.ptau pot12_final.ptau -v
# Generate proving key
snarkjs groth16 setup circom.r1cs pot12_final.ptau circuit_0000.zkey
# Contribute to the proving key
snarkjs zkey contribute circuit_0000.zkey circuit_0001.zkey --name="1st Contributor Name" -v
# Export verification key
snarkjs zkey export verificationkey circuit_0001.zkey verification_key.jsonStep 4: Generating and Verifying Proofs
Once you have the proving key and witness, you can generate and verify proofs.
# Generate proof
snarkjs groth16 prove circuit_0001.zkey witness.wtns proof.json public.json
# Verify proof
snarkjs groth16 verify verification_key.json public.json proof.json
# Expected output: [INFO] snarkJS: OK!Setting Up MoPro Mobile Apps
Initialize MoPro Project
cd benchmarking-suite/moPro/mopro-sha256
# Initialize MoPro configuration
mopro init
# Build native bindings
mopro build
# Generate platform templates
mopro create
# Update bindings after changes
mopro updateAndroid Development
Prerequisites: Android Studio, Android SDK, Java 11+
# Open in Android Studio
open android -a Android\ Studio
# Or build from command line
cd android
./gradlew build
# Run on device
./gradlew installDebugiOS Development
Prerequisites: Xcode, macOS, CocoaPods
# Open in Xcode
open ios/MoproApp.xcodeproj
# Or build from command line
cd ios
xcodebuild -project MoproApp.xcodeproj -scheme MoproApp buildRunning Tests
# Run Rust tests
cargo test
# Test specific circuit
cargo test test_circom
# Run with verbose output
cargo test -- --nocaptureCommon Issues and Solutions
Circuit Compilation Errors
Issue: "Too many values for input signal"
Solution: Make sure your input JSON only contains fields that match circuit inputs. Remove any extra fields like 'hash', 'N', etc.
Issue: "Not enough coefficients"
Solution: Your Powers of Tau file is too small. Use a larger pot file (pot14 → pot16 → pot18 → pot20).
Issue: Library import errors
Solution: Check import paths in your circuit files. Use relative paths to circomlib and other libraries.
MoPro Build Issues
Issue: UniFFI version mismatch
Solution: Make sure you're using UniFFI version 0.29.0 as specified in Cargo.toml.
Issue: Android build fails
Solution: Ensure you have the correct Android SDK version and Java 11+ installed. Run mopro update to refresh bindings.
Performance Issues
Issue: Slow proof generation on mobile
Solution: This is expected for large circuits. Use physical devices instead of emulators for accurate benchmarks. Consider using ZK-friendly hash functions like Poseidon for better performance.