Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 1.98 KB

README.md

File metadata and controls

46 lines (34 loc) · 1.98 KB

libsnark-porting

This android-studio project only ported libsnark to arm64. armeabi-v7a(arm32) have some error at prove and verify.


Elliptic curve choices

use ALT_BN128. more detail https://github.com/scipr-lab/libsnark


CMake option

vi ~/your-workspace/snarkportingtest/app/build.gradle

  • ANDROID_TOOLCHAIN=4.7 : Select compiler version
  • _ANDROID_STL=c++shared : If you link library, you need this option
  • WITH_PROCPS=OFF : libprocps is not necessary to link the library.
  • CURVE=ALT_BN128 : use ALT_BN128
  • WITH_SUPERCOP=OFF : supercop is assembly language.(can't use at arm machine)
  • OPT_FLAGS=-Os -march=armv8-a : select machine
  • PERFORMANCE=ON : OFF DEBUG MODE

Project Structure

  • MINIMUM SDK VERSION : 23(ANDROID 6.0 Marshmallow)
  • NDK VERSION : 21.3.6528147
  • Android Gradle Plugin Version : 4.0.1
  • Gradle Version : 6.1.1

Verify using Libsnark library

use https://github.com/snp-labs/CRV

build libsnark library as command

cmake -DCURVE=ALT_BN128 -DWITH_PROCPS=OFF -DWITH_SUPERCOP=OFF -DMULTICORE=OFF -DUSE_ASM=OFF -DBINARY_OUTPUT=ON -DMONTGOMERY_OUTPUT=OFF ..

these cmake options must be defined to use CRS and proofs derived from Android

copy your CRS and proofs to ~/your-workspace/CRV/JsnarkCircuitBuilder/datafiles

use command described in link above to run libsnark library