Server is able to create zk-SNARK proofs of headers batch validity and publish them to smart contract. Client uses these proofs as checkpoints for its local header chain.
- docker
- docker-compose
- yarn
- metro
- python3
Included zokrates setup is predefined for 32 header batches
make compile
Uses validator genereated during make compile
. Deploys to predefined provider in constants.py
.
make deploy
blockchain ids are constants set in smart contract:
- 0 - btc starting in genesis
- 1 - btc starting in a test block
- 2 - bch starting in genesis
- 3 - bch starting in a test block
Will create proofs for 32 header sized chinks starting with [start height] and ending at [end height] if [end height] is lower than start of chunk+32 the proof will be genrated for start of chunk+32 anyway. It is also a computationaly heavy task.
python3 ./Server/main.py proof [blockchainId] [start height] [end height]
Will publish previosuly generated proofs when wider range than 32 the proofs will be batched into single message, creating only one chckpoin.
python3 ./Server/main.py interact [blockchainId] [start height] [end height]
SDK and cosntants are fully described in ./ZkWallet/README.md
yarn react-native start
yarn react-native run
Server uses rest api for providing up to date Contract address and abi. You can configure them in the app as constants and server will be unecessary. Constants and functionality are fully described in ./Server/README.md
make init
make dev
./Nginx - proxy point
./Server - server implementation
/src/bitcoin - bitcoin data gathering and parsing implementation
/src/ethereum - ethereum contract deployment and interaction
/src/utils - general utils
/src/smartContracts - contracts and zokrates handlers
/contracts - contract programs
/zokrates - zokrates program and generated data
./ZkWallet - wallet implementation
/android/app/src/main/java/com/zkwallet - Native module implementation with geth instatiation
/src - main react native module
/app - app files
/components - app components
/config - global constants
/navigation - navigation configuration
/redux - state managment
/screens - screen components
/utilities - general utilities
./Zokrates - functioning zokrates toolbox
Provided makefile also contains an easy to execute shotcuts for testig. It uses previously mentioned python script.
- Creates proof for first 32 headers. make proof
- Submits the previously created proof to smart contract make intercat
- Calls clients function to check current head of smart contract header chain. make call