[!WARNING] This repository is deprecated and no longer maintained.
Polygon zkEVM has been retired. Polygon CDK chains now run on cdk-op-reth and settle to the Agglayer with pessimistic proofs and full execution proofs. This code is kept for reference only. It will not receive bug fixes, security patches, or releases.
Use instead:
- Proving: agglayer/provers
- Agglayer node: agglayer/agglayer
- Docs: docs.polygon.technology
Have funds locked in contracts on zkEVM mainnet? See zkevm-proof-of-ownership-kit.
Security issues in live Polygon systems: see SECURITY.md.
Built to interface with Ethereum Virtual Machines (EVM), the prover provides critical services through three primary RPC clients: the Aggregator client, Executor service, and StateDB service. The Aggregator client connects to an Aggregator server and harnesses multiple zkEVM Provers simultaneously, thereby maximizing proof generation efficiency. This involves a process where the Prover component calculates a resulting state by processing EVM transaction batches and subsequently generates a proof based on the PIL polynomials definition and their constraints. The Executor service offers a mechanism to validate the integrity of proposed EVM transaction batches, ensuring they adhere to specific workload requirements. The StateDB service interfaces with a system's state (represented as a Merkle tree) and the corresponding database, thus serving as a centralized state information repository.
aggregator.proto.executor.proto file.statedb.proto file.Steps to compile zkevm-prover locally:
git clone --recursive https://github.com/0xPolygonHermez/zkevm-prover.git
cd zkevm-prover
Download this very large archive (~75GB). It's a good idea to start this download now and have it running in the background:
./tools/download_archive.sh
The archive will take up an additional 115GB of space once extracted.
The following packages must be installed.
Important dependency note: you must install libpqxx version 6.4.5. If your distribution installs a newer version, please compile libpqxx 6.4.5 and install it manually instead.
apt update
apt install build-essential libbenchmark-dev libomp-dev libgmp-dev nlohmann-json3-dev postgresql libpqxx-dev libpqxx-doc nasm libsecp256k1-dev grpc-proto libsodium-dev libprotobuf-dev libssl-dev cmake libgrpc++-dev protobuf-compiler protobuf-compiler-grpc uuid-dev
zypper addrepo https://download.opensuse.org/repositories/network:cryptocurrencies/openSUSE_Tumbleweed/network:cryptocurrencies.repo
zypper refresh
zypper install -t pattern devel_basis
zypper install libbenchmark1 libomp16-devel libgmp10 nlohmann_json-devel postgresql libpqxx-devel ghc-postgresql-libpq-devel nasm libsecp256k1-devel grpc-devel libsodium-devel libprotobuf-c-devel libssl53 cmake libgrpc++1_57 protobuf-devel uuid-devel llvm llvm-devel libopenssl-devel
dnf group install "C Development Tools and Libraries" "Development Tools"
dnf config-manager --add-repo https://terra.fyralabs.com/terra.repo
dnf install google-benchmark-devel libomp-devel gmp gmp-devel gmp-c++ nlohmann-json-devel postgresql libpqxx-devel nasm libsecp256k1-devel grpc-devel libsodium-devel cmake grpc grpc-devel grpc-cpp protobuf-devel protobuf-c-devel uuid-devel libuuid-devel uuid-c++ llvm llvm-devel openssl-devel
pacman -S base-devel extra/protobuf community/grpc-cli community/nlohmann-json extra/libpqxx nasm extra/libsodium community/libsecp256k1
You may first need to recompile the protobufs:
cd src/grpc
make
cd ../..
Run make to compile the main project:
make clean
make generate
make -j
To compile in debug mode, run make -j dbg=1.
./build/zkProver -c testvectors/config_runFile_BatchProof.json
To use persistence in the HashDB (Merkle-tree) service you must create the database objects needed by the service. To do this run the shell script:
./tools/statedb/create_db.sh <database> <user> <password>
For example:
./tools/statedb/create_db.sh testdb statedb statedb
sudo docker build -t zkprover .
sudo docker run --rm --network host -ti -p 50051:50051 -p 50061:50061 -p 50071:50071 -v $PWD/testvectors:/usr/src/app zkprover input_executor.json
To run the Prover, supply a config.json file containing the parameters that help customize various Prover settings. By default, the Prover accesses the file config/config.json. You can specify a different config file location using the '-c ' argument. In order to know about the different available configuration parameters, please read the src/config/README.md file.
To execute a proof test:
config.json file, setting the "runFileGenProof" parameter to "true". Ensure all other parameters are set to "false". If you prefer not to use a PostgreSQL database for the test, adjust the "databaseURL" to "local"."inputFile" parameter, specify the desired input test data file. As an example, use the file testvectors/batchProof/input_executor_0.json.build/zkProver."outputPath" configuration parameter.For more discussions, please head to the R&D Discord