🤖

ZkProver

Introduction to ZkProver

ZkProver is a zero-knowledge proof client developed by CortexLabs for generating proofs in the Layer2 ZkRollup solution. The client currently supports three modes: local mode, server mode, and client mode.
Proof generation consumes a lot of computer computing resources. It takes about 30 seconds to generate a 64-size block proof using CPU. Furthermore, it is difficult to achieve parallel acceleration on the machine. Therefore, CortexLabs has developed a GPU version, which can effectively use multiple graphics cards for parallel computing and improve performance up to 2 times. The main difficulty lies in optimizing ZKP calculations in parallel. The underlying library calculations are complex, making it extremely difficult to implement the GPU version.
Configuration requirements
Cortex runs a full ZkProver on the following machines, the configuration is for reference only:
  • CPU - Intel(R) Xeon(R) CPU E5-2678 v3 @ 2.50GHz
  • Memory - 16G
  • CUDA version
    • 11.5, 11.6
    • 10.0
  • GPU (corresponding to GPU version Prover), theoretically supported graphics cards (checked if tested):
    • NVIDIA GeForce RTX 1080Ti
    • NVIDIA GeForce RTX 2080Ti
    • NVIDIA GeForce RTX 3090
  • Disk - 10G hard disk (including 4.9G proof private key)
  • OS (System) - Ubuntu 18.04.6 LTS
Pre-download: A total of 5G for the certificate private key and running program, the directory structure is as follows:
$ tree .
zion_node_cpu*
zion_node_gpu*
conf/
├── pk/
│ ├── block_key_16_mcl_bn128.pk.raw
│ ├── block_key_32_mcl_bn128.pk.raw
│ ├── block_key_64_mcl_bn128.pk.raw
│ └── block_key_8_mcl_bn128.pk.raw
└── vk/
├── block_key_16_mcl_bn128.vk.json
├── block_key_32_mcl_bn128.vk.json
├── block_key_64_mcl_bn128.vk.json
└── block_key_8_mcl_bn128.vk.json
Link within Mainland China: http://18.177.141.87:8827/.
Link outside of Mainland China: http://13.56.159.241:8827/.

Help options

Usage: zion_node [OPTIONS]
===========================
Prover Command Line for Zion
An integral prover tools, supports remote call,
local config settings, connection with zk_node, ...etc.
OPTIONS:
--init-key =false Generate proving&verification key if not exist
--key-dir =./conf Prover key directory
--verify Test for proof verify interface
proof-local:
--local Enable local proof generator with arguments
--local-fdir Set file directory to generate block proof, no recursive
--local-fpath Set file path to generate block proof
proof-server:
--server Enable server module
--server-host=0.0.0.0 Server host to listen
--server-port =2106 Server port to bind
prover-client:
--client Enable prover client with arguments
-b, --block-size Options: {8,32,64};
Block size that the prover could generate proof. block_s
ize=64 is best in GPU mode
--cycle-wait =3000 Interval prover poll job from the zion node server(ms)
--heartbeat =2000 Interval for sending heartbeat packets(ms)
-N, --name =proverZ The name of the prover
-n, --number =1 Job numbers requested from server at the same time
--save-dir Save job from server into local dir
--uri=127.0.0.1:8837
URI of the ZkNode server
logs:
--gdb-trace-level L
=10 Set gdb trace level when encounter error
--log-color=true Whether to enable colorize printer
--log-file FILE Redirect output to log file
--log-level =INFO Options: {FATAL,ERROR,WARNING,NOTICE,INFO,DEBUG};
Log level for print verbosity, case sensitive
--log-name =true Whether to print log level name
--log-source =false Whether to print file&line when logging
--log-time =true Whether to print datetime when logging
---------------
zion c++ prover

Local mode

Local mode is generally used for debugging, verifying local input files, and generating corresponding proofs. Use --local to access. Common commands:
# generate proof for one witness file.
./zion_node_cpu --local --local-fpath your/witness/file/path
# find all *.json in the directory
./zion_node_cpu --local --local-fdir your/witness/dir

Server mode

This mode is deprecated. Use --server to access.

Client Mode

Client mode is used to link with the ZkMatrix backend to generate proofs for Layer 2. Common commands:
# cpu prover command
./zion_node_cpu --client -b 64 --uri 18.177.141.87:8837 --name YOUR_NAME --cycle-wait 3000
# GPU use 2 graphic cards and save all witness files into logs directory.
CUDA_VISIBLE_DEVICES=1,2 ./zion_node_gpu --client --save-dir logs -b 64 -n 2 --uri 18.177.141.87:8837
CortexLabs' ZkMatrix server address: 18.177.141.87:8837, block size is 64. ETHF' ZkMatrix server address: 18.176.57.238:8837, block size is 64.
The client mode can automatically store the witness file obtained from the server. If you find that the program crashes or the proof is wrongly generated, please report the witness file to the official mailbox of CortexLabs.
Last modified 2mo ago