Skip to content

ZeroBase-Pro/solanaslm-integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

solanaslm-integration

Overview

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.

Getting Started

Directory Structure

  • /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.

a. Installation

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 install

Download 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.

b. Generate the nonce Field in the JWT

The nonce field in the JWT (constructed by the API provider) is generated using:

nonce = Poseidon([highpartPK, lowpartPK, exp, project_id])

  • exp is a user-defined value.

c. Generate ZKLogin Circuit Input File

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.js

This 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.

d. Run the Circuit (Locally)

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.sh

The circuit will begin execution and produce output files in the build/ZKLogin_solanaslm_circuitName/ directory:

  • proof.json: The proof generated by the circuit
  • public.json: The public witness file
  • vkey.json: The verification key file

References

License

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors