# Semaphore and Aadhaar Circuit SPEC Sheet ## Internals of Semaphore + Aadhar ### 1. Semaphore Protocol - Allows proving membership in a group without revealing individual identity - Enables passing of signals and messages without revealing input data ### 2. Aadhaar Circuit - Verifies Aadhaar QR code data - Extracts age, gender, state, and PIN code with `extractor.circom` - Validates RSA signature of the Aadhaar data ### 3. Integration Concept - Use Aadhaar circuit for initial verification and data extraction - Use Semaphore for anonymous group membership and signaling ### 4. Identity Creation (Semaphore) - Use EdDSA curve for key and commitment generation - Steps: 1. Generate random scalar `r` 2. Derive private key from `r` 3. Calculate public key (qx, qy) as `r * G` (where G is the Generator point) 4. Generate commitment from public key Semaphore identity => (private_key, commitment) ### 5. Group Structure - Use incremental Merkle trees - Each leaf contains an identity commitment - Groups can represent events, polls, or organizations ### 6. Aadhaar Verification Process 1. User provides Aadhaar QR code 2. Circuit verifies RSA signature 3. Extract relevant data: age, gender, state, PIN code ## 7. Semaphore Integration - Use extracted Aadhaar data to define group membership criteria - Create Semaphore identity for the user - Add user's commitment to the appropriate Merkle tree (group) ## 8. Signaling - Users can send signals or messages anonymously within their group. - Possible signals value: `age`, `gender` and `date of birth` - In terms of semaphore `scope` are `age` , `gender` and `date of birth` and `message` signal are values of scope attributes ## User Flow 1. User uploads Aadhaar card QR data. 2. Use Anonaadhar circuits to verify the RSA signature of the Aadhaar data. 3. Use `extractor.circom` to extract parameters like age, gender, state, and PIN code. 4. Utilize Semaphore to create an identity and verify group membership. 5. Store Merkle roots and Merkle paths for each group on IPFS instead of a backend service. 6. Once validated as a group member, the user can send anonymous signals within the group. Questions 1. where to store merkle path for each group members in commitment? smart contract or ipfs 2. storing commitment onchain indivial commitment and save in onchain. but how can we verify commitment is same onchain and groth16 proof onchain. we can't link groth16 proof and commitment to it? 3. `commitment` is hash of public key ## New Flow will be like 1. generate semephore idenity which is hash of public key 2. we will generate semaphore identity. 3. create smart contract struct online with something in it. ## Register Flow 1. we generate semephore indentiy done 2. we have custom contract. done 3. we just use custom contract and call all this methods all this group access 4. 5. we will list of all users using subgraph. 6. once this is done we will use aadhar verifier circuit to get the groth16 proof as pass this nullifier some how verify