Skip to content

Commit

Permalink
cleanup, readme changes
Browse files Browse the repository at this point in the history
  • Loading branch information
signorecello committed Feb 14, 2024
1 parent 91eedaf commit 4bb5dff
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 23 deletions.
36 changes: 16 additions & 20 deletions vite-hardhat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ 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:

1. Install [yarn](https://yarnpkg.com/) (tested on yarn v1.22.19)

2. Install [Node.js >20.10 (latest LTS)](https://nodejs.org/en) (tested on v18.17.0)

3. Install [noirup](https://noir-lang.org/getting_started/nargo_installation/#option-1-noirup) with

```bash
Expand Down Expand Up @@ -46,13 +44,11 @@ cd circuits
nargo codegen-verifier
```

A file named `plonk_vk.sol` should appear in the `circuits/contracts/with_foundry` folder.
A file named `plonk_vk.sol` should appear in the `circuit/contracts/noirstarter` folder.

### Test locally

1. Copy `vite-hardhat/.env.example` to a new file `vite-hardhat/.env`.

2. Start a local development EVM at <http://localhost:8545> with
1. Start a local development EVM at <http://localhost:8545> with

```bash
npx hardhat node
Expand All @@ -64,7 +60,7 @@ A file named `plonk_vk.sol` should appear in the `circuits/contracts/with_foundr
anvil
```

3. Run the [example test file](./test/index.test.ts) with
2. Run the [example test file](./test/index.test.ts) with

```bash
yarn test
Expand All @@ -91,29 +87,29 @@ The test demonstrates basic usage of Noir in a TypeScript Node.js environment.
3. Build the project and deploy contracts to the local development chain with

```bash
NETWORK=localhost yarn build
yarn build
```

> **Note:** If the deployment fails, try removing `yarn.lock` and reinstalling dependencies with
> `yarn`.
4. Once your contracts are deployed and the build is finished, you can preview the built website with

```bash
yarn preview
```

### Deploy on networks
### Deploy on testnets

For convenience, we added two configurations for deployment on various testnets. You can find them in `hardhat.config.cts`.

You can choose any other network in `hardhat.config.ts` and deploy there using this `NETWORK`
environment variable.
To deploy on these testnets, copy the `.env.example` and add your own [alchemy](https://www.alchemy.com/) keys for these networks.

For example, `NETWORK=mumbai yarn build` or `NETWORK=sepolia yarn build`.
Then, prepend your commands with your desired network in a `NETWORK` environment variable. For example, to deploy on sepolia:

Make sure you:
```bash
NETWORK=sepolia yarn build`
```

- 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 add more networks, just make sure you:

Feel free to contribute with other networks in `hardhat.config.ts`
- Add deployer private keys and alchemy API keys in `vite-hardhat/.env`
- Have funds in these accounts
- Add a configuration in `hardhat.config.cts`
2 changes: 1 addition & 1 deletion vite-hardhat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dev": "yarn prep && hardhat compile && yarn deploy && vite",
"build": "hardhat compile && yarn deploy && vite build",
"preview": "vite preview",
"deploy": "hardhat compile && NODE_OPTIONS='--experimental-loader ts-node/esm/transpile-only' hardhat run --network ${NETWORK} scripts/deploy.ts",
"deploy": "hardhat compile && NODE_OPTIONS='--experimental-loader ts-node/esm/transpile-only' hardhat run --network ${NETWORK:-localhost} scripts/deploy.ts",
"test": "NODE_OPTIONS='--experimental-loader ts-node/esm/transpile-only' hardhat test"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion vite-hardhat/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { CompiledCircuit, ProofData } from '@noir-lang/types';
import { join, resolve } from 'path';

async function getCircuit() {
const basePath = resolve(join('./circuits'));
const basePath = resolve(join('./circuit'));
const fm = createFileManager(basePath);
const result = await compile(fm);
if (!('program' in result)) {
Expand Down
2 changes: 1 addition & 1 deletion vite-hardhat/utils/addresses.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"chainId":31337,"verifier":"0x322813fd9a801c5507c9de605d63cea4f2ce6c44"}
{"chainId":31337,"verifier":"0x7a2088a1bfc9d81c55368ae168c2c02570cb814f"}

0 comments on commit 4bb5dff

Please sign in to comment.