├── .gitattributes ├── .gitignore ├── Nargo.toml ├── .prettierignore ├── .gitmodules ├── .prettierrc ├── package.json ├── npx.js ├── LICENSE-MIT ├── CONTRIBUTING.md └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | *.nr linguist-language=Rust -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | proofs/ 2 | target/ 3 | Prover.toml 4 | Verifier.toml -------------------------------------------------------------------------------- /Nargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = [ 3 | "add", 4 | "if", 5 | "for" 6 | ] -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Add files here to ignore them from prettier formatting 2 | 3 | /dist 4 | /coverage 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "with-foundry/lib/foundry-noir-helper"] 2 | path = with-foundry/lib/foundry-noir-helper 3 | url = https://github.com/0xnonso/foundry-noir-helper 4 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "avoid", 3 | "singleQuote": true, 4 | "trailingComma": "all", 5 | "printWidth": 100, 6 | "proseWrap": "always" 7 | } 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-noir", 3 | "version": "0.1.3", 4 | "type": "module", 5 | "description": "This is a reference repo to help you get started with writing zero-knowledge circuits with [Noir](https://noir-lang.org/).", 6 | "bin": "npx.js", 7 | "author": "", 8 | "license": "ISC", 9 | "dependencies": { 10 | "@inquirer/input": "^1.2.16", 11 | "@inquirer/select": "^1.3.3", 12 | "commander": "^11.1.0", 13 | "tiged": "^2.12.6" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /npx.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import { Command } from 'commander'; 3 | import select from '@inquirer/select'; 4 | import input from '@inquirer/input'; 5 | const program = new Command(); 6 | import tiged from 'tiged'; 7 | 8 | program.action(async () => { 9 | const appType = await select({ 10 | message: 'Please choose an option:', 11 | choices: [ 12 | { value: 'vite-hardhat', name: 'Browser App using Vite' }, 13 | { value: 'with-foundry', name: 'Solidity App using Foundry' }, 14 | ], 15 | }); 16 | 17 | console.log(`You chose: ${appType}`); 18 | 19 | const appName = await input({ 20 | message: 'Your app name:', 21 | default: 'my-noir-app', 22 | }); 23 | 24 | const emitter = tiged(`noir-lang/noir-starter/${appType}`, { 25 | disableCache: true, 26 | force: true, 27 | verbose: true, 28 | }); 29 | 30 | emitter.on('info', info => { 31 | console.log(info.message); 32 | }); 33 | 34 | emitter.clone(`./${appName}`).then(() => { 35 | console.log('done'); 36 | }); 37 | }); 38 | 39 | program.parse(); 40 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 noir-lang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | When contributing to this repository, please first discuss the change you wish to make via an issue. 4 | 5 | ## Contributing to an existing example project 6 | 7 | If you would like to contribute to an existing example project, please open an issue and tag one of the original 8 | authors or maintainers ([@critesjosh](https://github.com/critesjosh), [@signorecello](https://github.com/signorecello)) with your suggestion. 9 | 10 | ## Adding a new example project 11 | 12 | We are currently not accepting new contributions with starters. However, the Noir team encourages everyone to contribute to [awesome-noir](https://github.com/noir-lang/awesome-noir). 13 | 14 | If you want to contribute with unique ideas, check out Awesome Noir to see what's been done so far, or what's the status of each of the projects. Some unique ideas for boilerplates or examples, if you don't know where to start, would be: 15 | 16 | - Something integrating Angular 17 | - A React Native starter 18 | - A Svelte example 19 | - A server-side-rendered Go or Python app 20 | 21 | Basically anything that combines different technologies would be adding a lot to the ecosystem. If you'd like to discuss further, please message [@signorecello](https://github.com/signorecello) or [@critesjosh](https://github.com/critesjosh)! 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Solidity Circuits 4 | 5 | Write zero knowledge proofs in solidity. 6 | 7 | Creating an alternative frontend for noir / nargo, developers can write, prove and verify zk circuits that are written in solidity. 8 | 9 | That's it. 10 | 11 | ## What is in this repo? 12 | 13 | This repo contains a `nargo` workspace where the files are written in solidity. Each example demonstrates a different type of circuit, use the run instructions below to test each of them! 14 | 15 | ### How to run? 16 | 17 | 1. Make sure you have `noirup` installed - instructions below. 18 | 2. Go and clone this [branch of noir](https://github.com/noir-lang/noir/tree/md/solidity-circuits) 19 | 3. Run `noirup -p .` to replace your local nargo binary with the one with solidity support 20 | 4. Run `nargo check` to generate prover toml etc 21 | 5. Enter the values you want in your generate your proof with in `Prover.toml` 22 | 6. `nargo compile` 23 | 7. `nargo prove` 24 | 8. `nargo verify` 25 | 26 | 27 | ### First time with Noir? 28 | 29 | See the official Noir installation [instructions](https://noir-lang.org/getting_started/nargo_installation). 30 | 31 | Then, install the [Noir](https://github.com/noir-lang/noir) toolchain installer (`noirup`) with: 32 | 33 | ```bash 34 | curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash 35 | ``` 36 | 37 | Now you've installed the `noirup` binary, 38 | Follow the instructions above to install the solidity circuits branch. 39 | --------------------------------------------------------------------------------