Skip to content

tima-t/zkComputations

Repository files navigation

zkComputations

Large Computations Market based on zero-knowledge proofs. The core algorithm is based on Zero-Knowledge Succinct Non-Interactive Argument of Knowledge (SNARKs) generations and verification in EVM based smart contracts.

Why do we use Zero-Knowledge proofs?

Zero-Knowledge proofs are suitable for large computation problems, because we can quickly and on-chain verify wheter a given solution is correct or wrong. It could also give more flexibility to the Problem Solver and protect him from front-running.

How it works?

  1. Solution Seeker X wants to find the answer of Large Computation Problem.
  2. X generates a verifier contract and deploys it
  3. The verifier contract is funded by X with some amount that will be used for potential reward
  4. The Problem desciption is posted on ZkComputations UI app
  5. Problem Solver Y tries to solve the big computation problem
  6. If Y finds the solution then Y generates the proof off-chain using zokrates
  7. Y send transaction to Verifier Contract containing the proof and withdraws half of the amount
  8. Y is insentivized to reveal the actual solution to X (via email or on-chain) in order to receive the rest of the reward
  9. X can verify the actual solution and then send the extraReward to Y, otherwise his rating goes down and money are locked forever
  10. If X and Y finish the flow end to end this constitutes a Nash equilibrium,

Diagrams

Sequence Diagram

Payoff Matrix (Solution Seeker and Problem Solver)

There are 2 Nash Equilibrium at (X,A) = (0,0) and (Z,C) = (2,2). In this case (Z,C) has better fiancial outcome for both sides.

Install Zokrates and generate proofs

curl -LSfs get.zokrat.es | sh
# Set export path
export PATH=$PATH:/Users/tima_t/.zokrates/bin
cd zokrates-contracts/prime-numbers
# compile
zokrates compile -i primes.zok
# perform the setup phase
zokrates setup
# export a solidity verifier
zokrates export-verifier
# execute the program
zokrates compute-witness -a 1087
# generate a proof of computation
zokrates generate-proof
# or verify natively
zokrates verify

Start Fe App

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

This project uses next/font to automatically optimize and load Inter, a custom Google Font.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

About

zero-knowledge proof contracts based on zokrates

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published