GithubHelp home page GithubHelp logo

andrejrakic / zokrates-demo Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 1.88 MB

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

HTML 10.41% CSS 11.92% JavaScript 77.60% Shell 0.06%
zokrates zk-snarks ethereum

zokrates-demo's Introduction

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.

zokrates-demo's People

Contributors

andrejrakic avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

zokrates-demo's Issues

Update README.md

Update README file to show how to start an app, explain the workflow and give additional context. Include contract and files from Remix IDE is must

Alert API calls errors

Add .catch block to axios call i alert error instead of console.logging. To the existing .catch blocks (verifyTx call and isWeb3Connected call) add alert instead of console logging message.
Purpose of this is not to create handle errors mechanism thus this is just small demo app (so we don't need complete log, just UI indicator to end-user that something went wrong).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.