Home

Awesome

SNARK setup operator

The operator is responsible for monitoring and verifying the operation of the coordinator.

Tools included:

Compilation

Native

On Linux and macOS, building directly with cargo build --release should work, as long as you have the usual build toolchain installed (e.g. build-essential on Ubuntu). To build without ADX and BMI2 support, use cargo build --release --no-default-features.

On Windows, you have to use the GNU toolchain to compile and have the following in your PATH:

Cross compilation

Requires Docker.

Use the cross_compile.sh script in scripts, with one of linux, windows, macos, macos-m1. This will create an out folder in build with the binaries for that OS.

For example, to build for windows, you run ./scripts/cross_compile.sh windows and you'll find contribute-windows.exe, generate-windows.exe, contribute-windows-noasm.exe and generate-windows-noasm.exe in ./build/out.

The no-asm binaries will run on CPUs without ADX and BMI2 support, which has been introduced around 2015.

Testing

Generate keys for verifier and contributor:

cargo run --release --bin generate -- -k plumo-verifier.keys
cargo run --release --bin generate -- -k plumo-contributor.keys

Sample test file:

{
    "version": 0,
    "maxLocks": 3,
    "round": 0,
    "shutdownSignal": false,
    "contributorIds": [
    ],
    "verifierIds": [
        "address from plumo-verifier.keys"
    ],
    "chunks": [
    ]
}

Contents of .env:

COORDINATOR_CONFIG_PATH=ceremony/test.json
COORDINATOR_AUTH_TYPE=celo

Initializing ceremony:

RUST_LOG=info cargo run --bin new_ceremony --release -- --upload-mode direct --chunk-size 10 --powers 12 --server-url http://localhost:8080 --verifier $(cat plumo-verifier.keys | jq .address -r) --deployer $(cat plumo-verifier.keys | jq .address -r) --output-dir ~/snark-setup-coordinator/coordinator-service/.storage -k plumo-verifier.keys

Add the test participant and verifier:

RUST_LOG=info cargo run --bin control --release -- --keys-file plumo-verifier.keys add-participant --participant-id $(cat plumo-contributor.keys | jq .address -r)
RUST_LOG=info cargo run --bin control --release -- --keys-file plumo-verifier.keys add-verifier --participant-id $(cat plumo-verifier.keys | jq .address -r)

Contribute:

RUST_LOG=info cargo run --bin contribute --release -- --keys-file plumo-contributor.keys

Verify contribution:

RUST_LOG=info cargo run --bin contribute --release -- --participation-mode verify --keys-file plumo-verifier.keys