Anon Aadhaar is a protocol for proving ownership of an Aadhaar identity (Indian Residence ID) in a privacy-preserving manner. It lets users generate a ZK proof of their identity by only revealing the information they want to share (to an application).
Developers can use the AnonAadhaar SDK to integrate this into their applications to verify the identity of users without asking them to reveal more personal data than necessary. The proof generated can also be verified on EVM-based blockchains making Anon Aadhaar suitable for on-chain applications.
Demo App: Anon Aadhaar Example | Source
Documentation: Anon Aadhaar Documentation
Aadhaar data is signed by the government. Anon Aadhaar uses zero-knowledge circuits to verify this signature and generate proof of it.
A "verifier" (an app or a smart contract) verifying the proof can be sure the "prover" had a valid Aadhaar containing the information (like age, state, gender) they revealed.
Anon Aadhaar works on the client side (browser, mobile app) and does not require the user to send their Aadhaar details to any server. Read more
This repo contains the core ZK circuits of Anon Aadhaar and JS/React SDKs for developers to integrate into their applications.
The following packages are available, and published to npm:
- @anon-aadhaar/circuits - ZK circuits of Anon Aadhaar written in circom
- @anon-aadhaar/contracts - Solidity contracts to verify Anon Aadhaar proofs
- @anon-aadhaar/core - JS SDK to generate and verify Anon Aadhaar proofs
- @anon-aadhaar/react - React SDK including UI components to integrate Anon Aadhaar into React applications
To build on top of Anon Aadhaar, read out documentation here and check out the boilerplate repo (Next.js)
Below steps are for building Anon Aadhaar circuits locally and generating proof with it.
For production, always use the published npm packages.
- Node JS (v18 or higher)
- Yarn
yarn install
yarn build:libraries
# PWD = packages/circuits
yarn dev-install
yarn build-circuit
yarn dev-setup
This will generate the build
folder with the compiled circuit and artifacts. The generated zkey
is only meant for testing and should not be used in production.
# PWD = packages/circuits
yarn gen-test-data
This will generate dummy Aadhaar data and save it to packages/circuits/assets/test.json
The generated test data is verified using a test public/private key pair.
You can also use your real Aadhaar by setting env REAL_DATA=true
and QR_DATA=<QR_DATA>
(the large number in the Aadhaar QR code) in the gen-proof
script in the next section.
# PWD = packages/circuits
yarn gen-witness
yarn gen-proof
This will generate and save the proof to packages/circuits/build/proofs/proof.json
and the public signals to packages/circuits/build/proofs/public.json
yarn verif-proof
This will verify the generated proof and print the result to the console.
You can also generate the solidity verifier contract using yarn gen-contracts
and deploy it to a blockchain to verify the proof on-chain. You can use this method to convert the generated proof to a format that can be used in the contract.
Contributions with fixes and general improvements are always welcome. Please check the PR template
New features are currently being developed internally, but if you would like to work on any open issues, please comment on them and it will be assigned to you if possible.
Please join our Telegram group to receive updates, ask questions, get support with integration, etc.