-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-zk.sh
More file actions
57 lines (49 loc) · 1.67 KB
/
build-zk.sh
File metadata and controls
57 lines (49 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
# ============================================================
# SODS Protocol — Zero-Knowledge Build Script
# ============================================================
# This script compiles the sods-zk guest methods for the
# RISC Zero zkVM. It is intentionally separated from the
# main workspace build because the zkVM toolchain is heavy
# and requires the risc0 CLI to be installed.
#
# Prerequisites:
# 1. Install RISC Zero: cargo install cargo-risczero
# 2. Install the toolchain: cargo risczero install
#
# Usage:
# chmod +x build-zk.sh && ./build-zk.sh
# ============================================================
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ZK_DIR="${SCRIPT_DIR}/sods-zk"
echo "============================================"
echo " SODS Protocol — ZK Build"
echo "============================================"
echo ""
# 1. Check prerequisites
if ! command -v cargo &> /dev/null; then
echo "❌ Error: 'cargo' not found. Please install Rust first."
exit 1
fi
if ! cargo risczero --version &> /dev/null 2>&1; then
echo "⚠️ 'cargo-risczero' not found. Installing..."
cargo install cargo-risczero
cargo risczero install
echo "✅ RISC Zero toolchain installed."
fi
# 2. Build guest methods
echo ""
echo "🔧 Building sods-zk guest methods..."
echo " Directory: ${ZK_DIR}"
echo ""
cd "${ZK_DIR}"
cargo build --release
echo ""
echo "✅ ZK guest methods built successfully!"
echo ""
echo "📦 Artifacts:"
echo " ${ZK_DIR}/target/release/"
echo ""
echo "🚀 You can now use 'sods zk-prove' with the --zk feature enabled."
echo "============================================"