{"id":13750710,"url":"https://github.com/xorddotcom/SHIELD","last_synced_at":"2025-05-09T16:31:41.446Z","repository":{"id":47192158,"uuid":"513440945","full_name":"xorddotcom/SHIELD","owner":"xorddotcom","description":"Shield is a development framework for circom developers. The core reason is to provide libraries, plugins, and testing tools to ensure code quality and security.","archived":false,"fork":false,"pushed_at":"2023-01-25T23:50:49.000Z","size":1155,"stargazers_count":60,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-11T07:45:48.369Z","etag":null,"topics":["circom","circomlib","cli","groth16","nodejs","plonk","shield","snarkjs"],"latest_commit_sha":null,"homepage":"https://xord.notion.site/SHIELD-5306223ca4f745d19f54b9a5f4004cd6","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xorddotcom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-13T08:30:17.000Z","updated_at":"2024-10-24T08:56:47.000Z","dependencies_parsed_at":"2023-02-14T12:30:40.932Z","dependency_job_id":null,"html_url":"https://github.com/xorddotcom/SHIELD","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xorddotcom%2FSHIELD","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xorddotcom%2FSHIELD/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xorddotcom%2FSHIELD/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xorddotcom%2FSHIELD/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xorddotcom","download_url":"https://codeload.github.com/xorddotcom/SHIELD/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224869041,"owners_count":17383307,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circom","circomlib","cli","groth16","nodejs","plonk","shield","snarkjs"],"created_at":"2024-08-03T08:00:44.764Z","updated_at":"2024-11-16T02:31:30.645Z","avatar_url":"https://github.com/xorddotcom.png","language":"TypeScript","funding_links":[],"categories":["Code editors \u0026 tooling"],"sub_categories":["Cryptographic primitives in other languages"],"readme":"# SHIELD\n\n\u003cp align=\"center\" \u003e\n\u003cimg src=\"https://xord.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F283b98b7-fdae-4e5a-acaf-248242084e4a%2FICON.png?table=block\u0026id=5306223c-a4f7-45d1-9f54-b9a5f4004cd6\u0026spaceId=49976899-64a1-40fd-a3e6-c2ad82ad7aa1\u0026width=250\u0026userId=\u0026cache=v2\" alt=\"shield\" width=\"200\" height=\"200\"\u003e\n\u003c/p\u003e\n\nThe shield is a development framework for circom developers, but we plan it for other languages such as CAIRO, SNARKYJS, etc.\n\nThe core reason is to provide libraries, plugins, and testing tools to ensure code quality and security.\n\nCircomlib (which is the most popular library to build circom circuits) has over 1800 weekly downloads.\n\n## Pre-Requisite\n\n\nYou have to setup the environment before using it and install the following to get started with shield cli.\n\n#### Windows\n\n- [rust](https://www.rust-lang.org/tools/install)\n- [circom](https://docs.circom.io/getting-started/installation/)\n- [nodejs](https://nodejs.org/en/download/)\n\nIn future versions, we will provide a script to setup the environment with single command execution.\n\n#### Linux/Mac\n\n- [nodejs](https://nodejs.org/en/download/)\n\n\n## Installation\n\nInstall shield globally with npm:\n\n```bash\n\n$ npm i -g @xorddotcom/shield\n```\n    \n## Usage\n\n### Getting Started\n\nTo create a sample project, run\nIn future versions, we will provide a script to setup the environment with single command execution.\n\n```bash\n\n$ shield init\n```\n\ncreate a JavaScript, TypeScript project, or an empty shield.config.js\n\n```\n? What do you want to do? …\n❯ Create a JavaScript project\n  Create a TypeScript project\n  Create an empty shield.config.js\n  Quit\n```\n\n### Compiling your circuits\n\n```bash \n\n$ shield compile\n```\n\n```bash\n\nUsage: shield compile [options]\n\ncompiles the circuits to verifer contracts\n\nOptions:\n  -c, --circuit \u003cvalue\u003e  specific circuit to compile\n  -h, --help             display help for command\n\n\n```\n\n### Basic configuration\n\nSet up your project with the following minimal shield.config.js at the root. \n\n```javascript\n\nmodule.exports = {\n  // (optional) solidity version for compiled contracts, defaults to `^0.8.0`\n  solidity: \"^0.8.0\",\n  circom: {\n    // (optional) Base path for files being read, defaults to `./circuits/`\n    inputBasePath: \"./circuits/\",\n    // (optional) Base path for files being output, defaults to `./circuits/`\n    outputBasePath: \"./build/\",\n    // (required) The final ptau file, relative to inputBasePath, from a Phase 1 ceremony\n    ptau: \"powersOfTau28_hez_final_10.ptau\",\n    // (required) Each object in this array refers to a separate circuit\n    circuits: [\n      {\n        // (required) The name of the circuit\n        name: \"demo\",\n        // (optional) Protocol used to build circuits (\"groth16\" or \"plonk\"), defaults to \"groth16\"\n        protocol: \"groth16\",\n        // (optional) Input path for circuit file, inferred from `name` if unspecified\n        circuit: \"demo.circom\",\n        // (optional) Output path for zkey file, inferred from `name` if unspecified\n        zkey: \"demo.zkey\",\n        // (optional) Input path for input signal data, inferred from `name` if unspecified\n        input: \"input.json\",\n        // // (optional) Output path for witness file, inferred from `name` if unspecified\n        witness: \"demo.json\",\n      },\n    ],\n  },\n};\n\n```\n\n\nYour project structure should look like this:\n\n```javascript\n\n.\n├── circuits\n│   └── demo.circom\n└── shield.config.js\n\n```\nNow, you can use shield compile to compile the circuits and output demo_Verifier.sol, demo.zkey,demo.wasm and Verifier contract interface files into their respective directories:\n\n```javascript\n.\n├── build\n│   └── demo\n│       ├── circuit_0000.zkey\n│       ├── demo_js\n│       │   ├── demo.wasm\n│       │   ├── generate_witness.js\n│       │   └── witness_calculator.js\n│       ├── demo.r1cs\n│       ├── demo.sym\n│       ├── demo.zkey\n│       └── verification_key.json\n├── circuits\n│   ├── demo.circom\n│   ├── input.json\n│   ├── demo.wtns\n│   ├── demo.json\n│   └── powersOfTau28_hez_final_10.ptau\n├── contracts\n│   ├── demo_Verifier.sol\n│   └── interfaces\n│       └── IdemoVerifier.sol\n└── shield.config.js\n\n\n```\n\n### Debugging your circuits\n\nDebug feature allows you to display the circom circuits logs, input/output signals logs, and the passed/failed Constraints along with signals calculations. \n\nTo debug with an error stack trace and generate a witness JSON/Wtns file, run:\n\n```bash \n\n$ shield debug\n```\n\n\n```bash\n\nUsage: shield debug [options]\n\ndebug (display input/output signals, circuit logs, and passed/failed constraints ) and generate a witness file of the circuit\n\nOptions:\n  -c, --circuit \u003cvalue\u003e  specific circuit to debug\n  -h, --help             display help for command\n\n```\n\n#### Example debug logs\n\n```\n\nInput Signals:\n\n┌───────────┬────────┐\n│ (Signals) │ Values │\n├───────────┼────────┤\n│    c      │  '4'   │\n│    a      │  '2'   │\n│    b      │  '2'   │\n└───────────┴────────┘\n\nNo output signal found:\n\nConstraint no 1: passed\n\n=\u003e ((-1)*signal2) * (1*signal3) = ((-1)*signal1)\n\n=\u003e ((-1)*2) * (1*2) = ((-1)*4)\n\nRelated signals:\n\nsignal2: main.a, value: 2\n\nsignal3: main.b, value: 2\n\nsignal1: main.c, value: 4\n\n\n```\n\n## Contribution\nFor making a contribution refer to [CONTRIBUTION.md](https://github.com/xorddotcom/SHIELD/blob/main/CONTRIBUTION.md) file.\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n\n## Donate\n\n[![Buy Us A Coffee](https://srv-cdn.himpfen.io/badges/buymeacoffee/buymeacoffee-flat.svg)](https://cryptip.me/0xf1f7dfb65C47445ACA50319512373A50C396fCdF) \u0026nbsp;\n\n\n**Ethereum      :** `0xf1f7dfb65C47445ACA50319512373A50C396fCdF` \u003cbr /\u003e\n**Optimism      :** `0xf1f7dfb65C47445ACA50319512373A50C396fCdF` \u003cbr /\u003e\n**Polygon       :** `0xf1f7dfb65C47445ACA50319512373A50C396fCdF` \u003cbr /\u003e\n**Zksync        :** `0xf1f7dfb65C47445ACA50319512373A50C396fCdF` \u003cbr /\u003e\n**Arbitrum      :** `0xf1f7dfb65C47445ACA50319512373A50C396fCdF` \u003cbr /\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxorddotcom%2FSHIELD","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxorddotcom%2FSHIELD","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxorddotcom%2FSHIELD/lists"}