See also the README files of the various subpackages:
Tooling required:
- Make
- Foundry
- Last
foundryup
: 16 May 2023
- Last
- Node.js & PNPM (
npm install -g pnpm
)- Tested with Node v20.1.0
- The appropriate pnpm version is listed under the "packageManager key in
package.json
- If you have any issues while installing dependencies with pnpm you can try to use
corepack
to make sure you use correct version of pnpm.corepack enable
corepack pnpm install
- Circom
- Needed to build circuits package
- Tested with version 2.1.4
Run contract tests for basic sanity testing:
(cd packages/contracts && make test)
If you're using Visual Studio Code, the contract remappings will only be picked up if you set the
root of the project to the contracts
package. Otherwise, you'll add to manually add the remappings
(from remappings.txt
) to the Solidity plugin configuration.
To deploy and try out the app locally:
make dev
This will do the following from a single terminal (using run-pty):
- Run anvil (local EVM node) at localhost:8545 with chain ID 1337 (this chain comes preconfigured in Metamask and other wallets as "Localhost")
- Run the NextJS dev command (web server + live reload)
- Deploy the contracts to the local node
- Build the zk circuits (this make take a while, especially the first time when you'll need to download the 300MB trusted setup file). Make sure you have circom installed.
After that, you can visit the app at http://localhost:3000/ (if that port is already occupied, NextJS might affect another one).
If your shell doesn't support run-pty, you can run the commands manually in different terminals:
make anvil
make webdev
make deploy
make circuits
Note: at least for me, Metamask has a bug that doesn't let the app initiate chain switching when the target is "Localhost" (other targets work fine). If the same thing happens to you, you'll need to switch to the Localhost chain manually within the wallet.
See the Makefile for a description of all top-level make commands.