GitXplorerGitXplorer
o

proof-of-reserves-v2

public
7 stars
0 forks
18 issues

Commits

List of commits on branch main.
Verified
940b19b078a82640d3fa3e17bd715ce344e2026f

Merge pull request #82 from okx/dev

RRUAN0007 committed 11 days ago
Verified
595a181d9f5e2ed1cfe290af5d4457941880881f

Merge pull request #81 from okx/ruanpc/production

RRUAN0007 committed 11 days ago
Unverified
fe38c93d7e1229f2ffed69567b0cfff6e4165758

not to chunk user proofs for verification

RRUAN0007 committed 11 days ago
Unverified
108390f63d4a25bee1b49854091e268deebc8ef1

not to run integreatino test in workflow

RRUAN0007 committed 11 days ago
Unverified
5d7fdfd1ee424ff8b76a86ad0906ab6edca457ed

not to build test in release mode

RRUAN0007 committed 11 days ago
Unverified
8e773de247b646d7972b8e1a45b586c932a22641

format

RRUAN0007 committed 11 days ago

README

The README file for this repository.

Coverage

proof-of-reserves-v2

Background

OKX launches Proof of Reserves (PoR) to improve the security and transparency of users' assets. These tools will allow users to independently audit OKX's Proof of Reserves and verify OKX's reserves exceed the exchange's known liabilities to users, in order to confirm the solvency of OKX.

Technical Specs

The technical details can be found in the technical specs doc.

Liabilities

OKX's PoR uses Zero-knowledge (ZK) Merkle Sum Tree technology to allow each user to independently review OKX's digital asset reserve on the basis of protecting user's privacy. We use Plonky2 to build the proofs of users' assets using a Merkle Sum Tree. A detailed documentation of the technical solution can be found in the technical specs doc.

How to Run

  • generate test data
file_num=10
per_file_account_num=131072 # multiple of 1024, the batch size

# test data will be generated to ./test-data/user-data
python3 scripts/gen_test_data.py ${file_num} ${per_file_account_num}
  • prove
cfg_dir_path="config"

cp ${cfg_dir_path}/default.toml ${cfg_dir_path}/local.toml

# edit local.toml such that the field "user_data_path" to "test-data/user-data"
sed -i '' 's|/opt/data/zkpor/users/|test-data/user-data|g' config/local.toml

output_proof_dir_path="./test-data/proof"

cargo run --release --package zk-por-cli --bin zk-por-cli prove --cfg-path ${cfg_dir_path} --output-path ${output_proof_dir_path}
  • verify global proof
global_proof_path="./test-data/proof/global_proof.json"

cargo run --features zk-por-core/verifier --release --package zk-por-cli --bin zk-por-cli verify-global --proof-path ${global_proof_path}
  • verify user proof
global_proof_path="./test-data/proof/global_proof.json"
# to verify all accounts
user_proof_path_pattern="./test-data/proof/user_proofs/*.json"

# to verify one account with ${accountID}
# user_proof_path_pattern="./test-data/user_proofs/${accountID}.json"

cargo run --features zk-por-core/verifier --release --package zk-por-cli --bin zk-por-cli verify-user --global-proof-path ${global_proof_path} --user-proof-path-pattern ${user_proof_path_pattern}

cli tool

./target/release/zk-por-cli --help

Code Coverage

The code test coverage report is auto generated and hosted at codecov_report.

Docker

docker build -t okx_por_v2 -f docker/Dockerfile .