andrejrakic / zokrates-demo

Zokrates (library for ZkSnarks on Ethereum blockchain) demo app to prove that two numbers are equal 7 (or any other number) without revealing numbers itself

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Zokrates demo app

CI/CD CodeQL

Running

make sure to install necessary dependencies

cd ./server && npm start

cd ./client && yarn start

About the app

Developed using Zokrates plugin for Remix IDE

1) Zok file

main.zok

 def main(private field firstNumber, private field secondNumber, field sum) -> (field):

    field result = if firstNumber + secondNumber == sum then 1 else 0 fi

    return result

2) Verifier smart contract

verifier.sol is available on Rinkeby test net at 0x600c3dC2568d97D85082bE1110f7a9dC52C2123C

Navigate to smart contract via Etherscan

3) Flow

Server on start compiles zok file, does a setup (creates a proving key and a verification key pair).

After User input data on client side and press Compute button, request to server is being send.

Server then does a computation and generates proof which sends back to client as a response.

Client then uses proof as an argument to call smart contract's verifyTx function and after a response from blockchain displays to User success or failed verification.

About

Zokrates (library for ZkSnarks on Ethereum blockchain) demo app to prove that two numbers are equal 7 (or any other number) without revealing numbers itself

License:MIT License


Languages

Language:JavaScript 77.6%Language:CSS 11.9%Language:HTML 10.4%Language:Shell 0.1%