Giter Club home page Giter Club logo

zk-tool's Introduction

zk-tool

  • wrap libsnark tool for ourchain call function

build steps

install ourchain (skip if finished)

sudo apt-get update
sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils    
sudo apt-get install software-properties-common    
sudo add-apt-repository ppa:bitcoin/bitcoin 
sudo apt-get update
sudo apt-get install libdb4.8-dev libdb4.8++-dev
sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev
sudo apt-get install git
git clone -b test_version https://bitbucket.org/lab408/ourchain-release.git /tmp/ourchain
cd /tmp/ourchain/
./autogen.sh
./configure
make
sudo make install
sudo ldconfig

build library

sudo apt-get install build-essential cmake git libgmp3-dev libprocps4-dev python-markdown libboost-all-dev libssl-dev
cd /tmp/ourchain/src
git clone https://github.com/strongshih/zk-tool.git
cd zk-tool/
git submodule update --init --force --remote --recursive
mkdir build && cd build/
cmake ..
make

recompile ourchain

  • replace ourcontract.h and libourcontract.c with files under lib (just add addtional implementation for user to call)

     cp /tmp/ourchain/src/zk-tool/lib/ourcontract.h /tmp/ourchain/src/contract/
     cp /tmp/ourchain/src/zk-tool/lib/libourcontract.c /tmp/ourchain/src/contract/
    
  • recompile ourchain

     cd /tmp/ourchain
     make
     sudo make install
     sudo ldconfig
    

test

  • compile and prepare

     cd /tmp/ourchain/src/zk-tool
     ourcontract-mkdll contracts_example test
     export OURZKLIB=/tmp/ourchain/src/zk-tool/build/src/libourzklib.so
     ourcontract-rt contracts_example test
    

develop

  • call stack

     ourcontract-rt contracts_example test
                       |
                       V
     main in ourcontract-rt.c 
                       |
                       V
     start_runtime in libourcontract.c
                       |
                       V
     call_contract in libourcontract.c
                       |
                       V
     contract_main in contracts_example/test/code.so using dlsym
                       |
                       V
     // (1) develop function call for contract
     test_libsnark in libourcontract.c
                       |
                       V
     // (2) using dynamic library to call c++ code in libsnark and provide function simultaneously
     test_libsnark in zk-tool/src/test/test_libsnark.cpp (by using path to OURZKLIB)
                       |
                       V
     using any libsnark libraries
    
  • (1) and (2) are where we develop function call for user

  • check out files under ourchain/src/zk-tool/src

others

  • only add function into ourcontract.h and libourcontract.c, and add addtional folder zk-tool under ourchain/src

zk-tool's People

Contributors

strongshih avatar

Watchers

 avatar  avatar

Forkers

melsaa

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.