Skip to content
/ rapidsnark Public
forked from iden3/rapidsnark

rapidsnark is a zkSnark proof generation written in C++. That generates proofs created in circom and snarkjs very fast.

License

Notifications You must be signed in to change notification settings

okx/rapidsnark

 
 

Repository files navigation

Important note

This is a new implementation of rapidsnark. The original (and now obsoleted) implementation is available here: rapidsnark-old.

rapidsnark

Rapidsnark is a fast zkSnark proof generator written in C++ and Intel/ARM assembly. It generates proofs for circuits created with circom and snarkjs.

Dependencies

zk tools

  • install circom
git clone https://github.com/iden3/circom.git
cd circom
cargo build --release
cargo install --path circom

dev tools

Install gcc, cmake, libsodium, and gmp (development libraries).

  • On ubuntu:
sudo apt-get install build-essential cmake libgmp-dev libsodium-dev nasm curl m4

On MacOS:

brew install cmake gmp libsodium nasm
  • On mac
brew install gmp # install dependencies
brew install libomp
brew install nasm
brew install libevent # for server

third party project deps

  • nlohmann/json
  • circom_runtime
  • ffiasm
  • pistache (for proof server)
git submodule update --init

build in standalone mode

x86_64

git submodule update --init --recursive
./build_gmp.sh host
make host

build with server mode

macos_arm64

./build_pistache.sh

mkdir -p build_prover_macos_arm64 && cd build_prover_macos_arm64
cmake .. -DTARGET_PLATFORM=macos_arm64 \
           -DBUILD_SERVER=ON \
           -DLIB_EVENT_DIR=/opt/homebrew/opt/libevent/lib \
           -DCMAKE_BUILD_TYPE=Release \
           -DCMAKE_INSTALL_PREFIX=/usr/local \
           -DUSE_OPENMP=ON \
           -DLIB_OMP_PREFIX=/opt/homebrew/opt/libomp/ \
           -DGMP_INCLUDE_DIR=/opt/homebrew/include \
           -DGMP_LIB_DIR=/opt/homebrew/lib \
           -DUSE_LOGGER=ON
make -j4 && sudo make install
cd ..

build circuits

curl -L -o powersOfTau28_hez_final_15.ptau https://storage.googleapis.com/zkevm/ptau/powersOfTau28_hez_final_15.ptau
npm install
./build_circuit.sh
npx snarkjs groth16 setup build/02x03.r1cs powersOfTau28_hez_final_15.ptau zkeys/02x03_new.zkey
npx snarkjs zkey export verificationkey zkeys/02x03_new.zkey zkeys/02x03.vkey.json
mv zkeys/02x03_new.zkey zkeys/02x03.zkey

run rapidsnark server

/usr/local/bin/proverServer 8080 zkeys/02x03.zkey

About

rapidsnark is a zkSnark proof generation written in C++. That generates proofs created in circom and snarkjs very fast.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 66.6%
  • Assembly 29.3%
  • Shell 1.1%
  • C 0.8%
  • CMake 0.8%
  • Circom 0.5%
  • Other 0.9%