TWISTER
There is already a popular protocol for depositing an amount and withdrawing it from another account, but unfortunately the deposit amounts are predefined. Would you like to be able to deposit any amount in increments of 0.001 eth and withdraw that amount in one or more transactions.
Scroll sepolia address 0xda8c05c7f2783b0a8c1410636d379d0cd7cbd644
Noir with Vite and Hardhat
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!
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 verifier contract
Contract
The deployment assumes a verifier contract has been generated by nargo. In order to do this, run:
cd circuits
nargo codegen-verifier
A file named plonk_vk.sol
should appear in the circuits/contracts/with_foundry
folder.
Test locally
-
Copy
vite-hardhat/.env.example
to a new filevite-hardhat/.env
. -
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.
Deploy locally
-
Copy
vite-hardhat/.env.example
to a new filevite-hardhat/.env
. -
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
NETWORK=localhost yarn build
Note: If the deployment fails, try removing
yarn.lock
and reinstalling dependencies withyarn
. -
Once your contracts are deployed and the build is finished, you can preview the built website with
yarn preview
Deploy on networks
You can choose any other network in hardhat.config.ts
and deploy there using this NETWORK
environment variable.
For example, NETWORK=mumbai yarn build
or NETWORK=sepolia yarn build
.
Make sure you:
- Update the deployer private keys in
vite-hardhat/.env
- Have funds in the deployer account
- Add keys for alchemy (to act as a node) in
vite-hardhat/.env
Feel free to contribute with other networks in hardhat.config.ts