Users can obtain a time-sensitive JSON Web Token (JWT) generated by the Google API via their Google account. The JWT is then transformed into a circuit-compatible input format through a front-end script. Once the circuit receives the input and completes the proving process, a corresponding proof is generated to confirm that the JWT satisfies the circuit's logical constraints. This proof can then be shared with a verifier to demonstrate ownership of a valid JWT.
- /build: Stores output files generated by the ZKLogin circuit.
- /circuit: Contains the core ZKLogin circuit files.
- /inputs: Stores input files used for the circuit.
- /scripts: JavaScript scripts for generating circuit inputs.
- /shell: Shell scripts to run the circuit.
Make sure you have the following tools installed:
- Circom version 2.1.6 or later
- SnarkJS
- Node.js
Then, clone this repository and install the Node.js dependencies:
npm installDownload the appropriate PTAU file for your constraint level from the SnarkJS repository.
For this project, you can download this file and place it in the circuits/ptau/ directory.
The nonce field in the JWT (constructed by the API provider) is generated using:
nonce = Poseidon([highpartPK, lowpartPK, exp, project_id])
expis a user-defined value.
Provide the token and custom user data in the script scripts/circuit_name/scripts/generate_circuit_input.js, then run:
cd ./scripts/circuit_name/scripts
node generate_circuit_input.jsThis will generate a ZKLogin_solanaslm_circuitName.json file in the ./scripts/circuit_name/inputs/ directory.
This file contains all the required inputs for the ZKLogin circuit.
Copy the input .json file for the circuit you want to prove into the root-level inputs/ directory.
Then, navigate to the /shell directory and run:
./GenProof.shThe circuit will begin execution and produce output files in the build/ZKLogin_solanaslm_circuitName/ directory:
proof.json: The proof generated by the circuitpublic.json: The public witness filevkey.json: The verification key file
This project is licensed under a Commercial Software License.
Unauthorized use, copying, distribution, or modification of this software is prohibited.
For licensing inquiries, please contact https://t.me/zerobasezk.