Zero Knowledge Proof on Harmony:
We demonstrate private HMY ERC20 token transactions on Harmony testnet.
Install libsnark and zokrates. Using libsnark and zokrates, we generate the proving.key and verification.key as well as the corresponding verifier.sol (solidity smart contract).
export ZOKRATES_HOME=/path/to/zokrates_stdlib/stdlib
./zokrates compile -i zk-circuit.code (generate R1CS circuits)
./zokrates setup (generate prover and verifier keys)
./zokrates export-verifier (generate solidity smart contract)
Currently, we are manually deploying the smart contracts. At the same time, we are building Harmony SDK to make smart contract deployment easier.
The main smart contract is SecretNote.sol. It will call the verifier smart contract (verifier.sol) to verify whether the transaction is legal. We use Zokrates to generate verifier.sol. After deploying our smart contracts, we can use a front end to interact with the smart contract to send and withdraw money without leaking privacy information.
The code is modified based on zk-Dai project.