- Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Install forge (if you launch local network)
curl -L https://foundry.paradigm.xyz | bash
foundryup
- Install sqlx-cli
cargo install sqlx-cli
- Install wasm-pack
cargo install wasm-pack
Launch local network
anvil
Contract deployment
cd tests
cargo test -r -p tests deploy_contracts -- --nocapture
Launch database
docker run --name postgres -e POSTGRES_PASSWORD=password -p 5432:5432 -d postgres
Copy env file
You need to run cp .env.example .env
in each directory.
- Start Store-vault-server. Example port: 9000
cd store-vault-server && sqlx database setup && cargo run -r
- Start balance-prover. Example port: 9001
cd balance-prover && cargo run -r
- Start validity-prover. Example port: 9002
cd validity-prover && sqlx database setup && cargo run -r
- Start withdrawal-server. Example port: 9003
cd withdrawal-server && sqlx database setup && cargo run -r
- Start block-builder. Example port: 9004
cd block-builder && cargo run -r
Please refer to the examples of cli
(cd store-vault-server && sqlx database reset -y && cd ../validity-prover && sqlx database reset -y && cd ../withdrawal-server && sqlx database reset -y)
store-vault-server: A server that stores backups of user's local states. It also acts as a mailbox for sending necessary data to a receiver during transfers.
balance-prover: A server that generates client-side ZKPs on behalf of users. This server maintains no state.
validity-prover: A server that generates ZKPs related to onchain information. It collects onchain data and generates corresponding ZKPs.
block-builder: A server that receives transactions from users and generates blocks.
withdrawal-server: A server that receives withdrawal requests from users and writes them to the database.