An Ethereum L2 zk-rollup for privacy preserving and regulatory compliant transactions.
Here are some highlights:
- Fast - runs in under 3 seconds on an iPhone
- Tiny - UTXO proofs are under 2.8KB
- EVM-compatible - proofs can be verified on Ethereum
For a detailed description of the architecture, download the whitepaper or visit the docs.
| Module | Path | Desc |
|---|---|---|
| Frontends / TypeScript | app | Frontend applications and TypeScript packages |
| Ethereum Contracts | eth | Ethereum smart contracts to verify state transitions and proofs |
| Noir | noir | Noir circuits and related tooling |
| Aggregator | pkg/aggregator | Rollup aggregation services and supporting logic |
| Node | pkg/node | Core node implementation for the Payy network |
| Prover | pkg/prover | Core prover logic |
| RPC | pkg/rpc | RPC common utilities shared across all RPC services |
| Smirk | pkg/smirk | Sparse merkle tree |
| ZK-Primitives | pkg/zk-primitives | ZK primitives used across multiple modules |
We use Git LFS for large files such as proving parameters.
A one-time setup is required for local development:
- Install
git lfsby following the instructions at https://git-lfs.com/. - From the repository root, run:
git lfs install
git lfs pullThere are two core services needed to run the zk rollup stack, and you should start them in order:
- Eth (with contracts deployed)
- Node
You can run all of the services using the VSCode dev container:
Cmd-P -> "Dev Containers: Reopen in Container"
You can run all of the services using docker
Run
docker compose up -f ./docker/docker-compose.yml up -dTo only run services that are needed for a dev environment
Run
docker compose up -f ./docker/docker-compose.yml --profile dev up -dTo only run services that are needed for integration tests
Run
docker compose up -f ./docker/docker-compose.yml --profile test up -dTo only run services that are needed for CI workflows
Run
docker compose up -f ./docker/docker-compose.yml --profile ci up -dTo run the prover (optional) to enable withdrawals
Run
docker compose up -f ./docker/docker-compose.yml --profile prover up -dOnce the prerequisites above are installed you can bootstrap the local tooling with:
eval "$(cargo xtask setup)"What this does: The cargo xtask setup command installs the bb and nargo toolchains, ensures the polybase-pg Postgres container is running with the latest migrations, and installs the Ethereum workspace dependencies under eth/. It prints shell export commands to stdout, and wrapping it in eval "$(...)" executes those exports in your current shell so DATABASE_URL and any PATH updates take effect.
Environment variables set:
DATABASE_URL- Connection string for the local Postgres database
Important: These exports only persist for the current terminal session. For convenience, consider integrating this command into a repo-specific development shell (for example: direnv, nix shell, guix container) rather than global shell profiles like .bashrc or .zshrc, because the setup is too heavyweight for global profiles.
Re-run the command whenever you need to refresh the development environment; it is safe and idempotent.
Run the fast test wrapper during development to avoid rebuilding unaffected crates:
cargo xtask testThe command detects workspace crates with local changes (and any dependents), builds tests once via cargo test --workspace --no-run, then runs only the compiled test binaries for the affected crates (changed first, then their dependents), exiting early if nothing relevant changed.
Download and run the revi helper with any arguments (cached under ~/.polybase/revi):
cargo xtask revi -- <revi-args>You will need to install the following packages:
apt install libglib2.0-dev libssl-dev libclang-dev python3
Install protobuf
debian:
apt install protobuf-compiler libprotobuf-dev
macos:
brew install protobuf
Download the proving params before building or running Docker images. This caches the file in
~/.polybase/fixtures/params (override with POLYBASE_PARAMS_DIR):
./scripts/download-fixtures-params.shInstall/run postgres and create a db called guild.
docker (recommended):
docker run -it --rm -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=guild -e POSTGRES_USER=$USER -p 5432:5432 postgres:18macos:
brew install postgresql
brew services start postgresql
createdb guilddebian:
sudo apt install postgresql postgresql-contrib
sudo systemctl start postgresql
sudo systemctl enable postgresql
sudo -i -u postgres
createdb guildYou should be able to connect to the db using:
psql postgres://localhost/guild(if you're using mac, recommend using Postico)
Install diesel CLI:
cargo install diesel_cli --no-default-features --features postgresSetup the tables in the postgres database:
$ cd pkg/database
$ diesel migration runThis repository uses taplo to standardize TOML file formatting across all configuration files, including Cargo.toml, Nargo.toml, and other TOML files.
A GitHub Action automatically checks TOML formatting on:
- Pull requests (when TOML files are modified)
- Pushes to
mainbranches - Manual workflow dispatch
The CI will fail if any TOML files don't meet the formatting standards.
Install taplo CLI:
cargo install taplo-cli --locked
# or
curl -fsSL https://github.com/tamasfe/taplo/releases/latest/download/taplo-<platform>.gz | gzip -d - | install -m 755 /dev/stdin /usr/local/bin/taploFormat all TOML files in the repository:
taplo fmtCheck formatting without making changes:
taplo fmt --checkValidate all TOML files for syntax errors:
taplo checkThe formatting configuration is defined in taplo.toml at the repository root. The configuration ensures consistent formatting with:
- 2-space indentation
- Multi-line arrays for better readability
- Preserved dependency and key ordering
- Trailing newlines at end of files
- Node modules directories are excluded from checks
Setup the eth node:
$ cd eth
$ yarn install
$ yarn eth-node --hostname 0.0.0.0Then deploy the smart contracts to your eth node (in another terminal):
$ cd eth
$ DEV_USE_NOOP_VERIFIER=1 yarn deploy:localImportant
if you stop the eth-node server, you will need to redeploy the contracts again.
Run node:
$ cargo run --bin nodeRun node in prover mode (optional, enables withdrawals):
$ cargo run --bin node -- --mode mock-prover --db-path ~/.polybase-prover/db --smirk-path ~/.polybase-prover/smirk --rpc-laddr 0.0.0.0:8092 --p2p-laddr /ip4/127.0.0.1/tcp/5001Important
eth-node must be running before starting node.
Run guild:
$ cargo run --bin guild -- --firebase-service-account-path=payy-prenet-firebase.jsonImportant
node must be running before starting guild.
Get the deposit address from the app (Menu -> Deposit -> Deposit Address)
cargo run --bin wallet transfer <deposit-address> 100cargo test integration_test
docker build -f ./docker/Dockerfile.node --target tester .
We use cargo-hakari to keep a unified workspace-hack crate in sync across all Cargo.toml files. Run the following after adding or modifying workspace dependencies and before opening a pull request:
cargo hakari generate
cargo hakari manage-deps --yes
The Rust / Hakari Check GitHub workflow enforces that the crate stays synchronized; if it fails, re-run the commands above and commit the resulting changes.
We welcome contributions that improve the project for everyone.
If you discover a security issue, do not report it publicly. Send a full report to hello@polybaselabs.com so it can be handled responsibly.
If you find a bug, open an issue at github.com/polybase/payy/issues with reproduction steps, environment details, and any relevant logs or screenshots.
To propose a feature or improvement, open an issue at github.com/polybase/payy/issues and explain the problem, the proposed change, and why it is useful.
- Fork the repository.
- Create a feature branch.
- Make and test your changes.
- Commit and push the branch.
- Open a pull request at github.com/polybase/payy/pulls.
