Skip to content

Latest commit

 

History

History

vite-hardhat

Noir with Vite and Hardhat

Netlify Status

This example uses Vite as the frontend framework, and Hardhat to deploy and test.

Getting Started

Want to get started in a pinch? Start your project in a free Github Codespace!

Start your project in a free Github Codespace!

Locally

  1. Install your favorite package manager. We'll use bun but feel free to use yarn or others:

    curl -fsSL https://bun.sh/install | bash
  2. Install dependencies:

    bun i
  3. Run a node

    bunx hardhat node
  4. Deploy the verifier contract (UltraPlonk)

    bun run deploy
  5. Run the dev environment

    bun dev

Testing

You can run the example test file with

bun run test

This test shows the basic usage of Noir in a TypeScript Node.js environment. It also starts its own network and deploys the verifier contract.

If you want to test only UltraHonk, you can run:

bun run test:uh

Deploying on other networks

The default scripting targets a local environment. For convenience, we added some configurations for deployment on various other networks. You can see the existing list by running:

bunx hardhat vars setup

If you want to deploy on any of them, just pass in a private key, for example for the holesky network:

bunx hardhat vars set holesky <your_testnet_private_key>

You can then deploy on that network by passing the --network flag. For example:

bunx hardhat deploy --network holesky # deploys on holesky

Feel free to add more networks, as long as they're supported by wagmi (list here). Just make sure you:

  • Have funds in these accounts
  • Add their configuration in the networks property in hardhat.config.cts
  • Use the name that wagmi expects (for example ethereum won't work, as wagmi calls it mainnet)