This project implements a decentralized hyper-parameter search where off-chain workers train a tiny neural net, produce a Groth16 proof of their reported accuracy, and the on-chain AiOrchestrator verifies proofs and pays rewards.
- Client opens a job with a grid of hyper-parameters (e.g., 3 learning-rates × steps) and funds a bounty.
- Workers each claim exactly one grid slot, train locally, generate a witness + Groth16 proof, and submit their accuracy + proof to a contract on-chain.
- Orchestrator contract verifies proofs, records accuracies, and when closed, pays 50% to the best accuracy and splits the rest equally among other proven participants.
The project codebase includes:
- a Solidity orchestrator,
- a Circom circuit + verifier,
- a Python worker,
- and a simple client scripts to open requests.
- Modern Linux or Mac OS X operating system
- Rust 1.90+
- Node.js 18+
- pnpm 8+
- Python 3.9+ (venv recommended)
- circom 2.1.x (install via Cargo - see below)
- snarkjs 0.6.x (see below for installation instructions)
- ts-node 10.x (see below for installation instructions)
- ptau file for zk
circom (via cargo -> First Install Rust):
- cargo install --locked --git https://github.com/iden3/circom
snarkjs:
- pnpm i -g snarkjs
ts-node:
- pnpm install -g ts-node
Make sure pnpm and .cargo/bin directories are in your executable PATH.
- Open terminal window, navigate to the project directory and execute
make cleanto reset your environment to the initial state (if necessary)make depsto prepare the environmentmake startupto compile contracts and launch blockhain nodes locally.
- Open another terminal window in the project directory and execute
make runto compile off-chain workers, deploy contract onto the (local) blockchain, and submit sample ML training request.
- make startup # compile blockchain side, start blockchain nodes
- make run # deploy contract on the node, submit sample request
- make clean # remove all compiler artefacts and environment configuration
- make mlp-zk # compile ZK-proofs module
- make nde # compile contracts and start hardhat node
- make depl # deploy to localhost
- make req # open a sample request (grid + bounty)
- make workers-XX REQ_ID=X # compile and run XX workers, submit requests with ID X (number). Makefile defines 3, 6, 9, 12 worker targets. E.g.
make workers-12 REQ_ID=0
- contracts/
- AiOrchestrator.sol # assigns tasks, verifies proofs, pays rewards
- AccVerifier.sol # auto-generated by snarkjs (do not edit)
- circuits/
- MlpHoldoutAcc_256.circom #
- MlpHoldoutAcc_256_js/ # wasm + witness generator (generated)
- MlpHoldoutAcc_256_final.zkey # proving key (generated)
- client/
- open_request.ts # opens a request with a hyper-parameter grid
- node/
- compute_node.py # worker: claim, train, prove, submit
- Makefile
- .env