This example uses Vite as the frontend framework, and Hardhat to deploy and test.
Want to get started in a pinch? Start your project in a free Github Codespace!
In the meantime, follow these simple steps to work on your own machine:
-
Install yarn (tested on yarn v1.22.19)
-
Install Node.js >20.10 (latest LTS) (tested on v18.17.0)
-
Install noirup with
curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash
-
Install Nargo with
noirup
-
Install dependencies with
yarn
-
Generate the verifier contract
yarn prep
-
Start a local development EVM at http://localhost:8545 with
npx hardhat node
or if foundry is preferred, with
anvil
-
Run the example test file with
yarn test
The test demonstrates basic usage of Noir in a TypeScript Node.js environment.
-
Start a local development EVM at http://localhost:8545 with
npx hardhat node
or if foundry is preferred, with
anvil
-
Build the project and deploy contracts to the local development chain with
yarn build
-
Once your contracts are deployed and the build is finished, you can preview the built website with
yarn preview
The app will verify your proof locally. If you have a wallet, it will prompt you to connect to the relevant network and use it for on-chain verification.
For convenience, we added two configurations for deployment on various testnets. You can find them in hardhat.config.cts
.
To deploy on these testnets, rename .env.example
to .env
and add your own alchemy keys for these networks.
Then, prepend your commands with your desired network in a NETWORK
environment variable. For example, to deploy on sepolia:
NETWORK=sepolia yarn build`
Feel free to add more networks, just make sure you:
- Add deployer private keys and alchemy API keys in
.env
- Have funds in these accounts
- Add a configuration in
hardhat.config.cts