This is a proof-of-concept implementation of a zero-knowledge proof application designed for Gear-powered blockchains.
Note Keep in mind that this example is intended for educational purposes as a technology demonstration. For production use, it is recommended to introduce certain optimizations addressing potential performance and security vulnerability issues.
This implementation offers the capability to offload the resource-intensive computations from the blockchain while ensuring their integrity. As an illustrative example, we demonstrate the evaluation of the MNIST machine learning model. This is achieved by generating zero-knowledge proofs of computations and subsequently verifying them on-chain.
The process of employing zero-knowledge proofs for computations involves four key participants: Initializer
, User
, zk-smart-contract
and Prover
.
-
Initializer
: This participant is responsible for deploying thezk-smart-contract
onto the blockchain and initializing its parameters. During initialization, the structure of the machine learning model is defined, setting the stage for subsequent interactions. -
User
: Users of the system interact with thezk-smart-contract
by submitting their input data, which is intended for processing by the machine learning model. This step demonstrates how external parties can seamlessly engage with the blockchain without directly executing computationally intensive operations. -
Prover
: The prover retrieves this input from thezk-smart-contract
, conducts an evaluation of the machine learning model, and generates a zero-knowledge proof that attests to the validity of the computation. The resulting output of the machine learning model, along with the zero-knowledge proof, is then submitted back to thezk-smart-contract
. -
User Verification
: Users initiate a verification process by interacting with thezk-smart-contract
. Thezk-smart-contract
orchestrates the verification of the zero-knowledge proof, independently confirming the accuracy of the computation without exposing sensitive data. -
Verification Outcome
: Once the verification process is completed within thezk-smart-contract
, the user is informed of the verification outcome.