# Lagrange ZKsync Prover Setup
This is the document outlining the steps to run a Lagrange based ZKsync prover.
## Setting up the server with CUDA
As the ZKsync prover makes heavy use of CUDA for fast computation, GPU passthru must be enabled in the Docker server to allow CUDA to be used from within a container.
### General Instructions
https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
### Ubuntu-Specific Instructions
```shell
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
sudo apt-get install nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
```
## Lagrange ZKsync prover setup
### Getting the Image
The Lagrange/ZKsync prover is distributed in a Docker image, available here:
For L4 GPU:
```
docker pull lagrangelabs/lpn-zksync-prover:latest-89
```
For A10 GPU:
```
docker pull lagrangelabs/lpn-zksync-prover:latest-86
```
Two sources of data will must be injected through mounts in the running docker image instance.
### Configuration
The configuration file must be edited according to the worker details. It will be mounted under `/app/config/config.toml`.
**Important**: change the worker_id in the config
below by putting the name of the company running it so we can identify the exact work provided by your server.
**config.toml:**
```config.toml
[prover]
setup_data_path = "/data/keys"
[gateway]
gateway_grpc_url = "https://gateway-lcp-dev-0-zk-sync.dev.distributed-query.io/"
max_grpc_message_size_mb = 16
[worker]
worker_id = "zksync-circuit-prover"
operator_id = "Lagrange"
lagr_private_key = "779ff5fe168de6560e95dff8c91d3af4c45ad1b261d03d22e2e1558fb27ea450"
class = "ZKSYNC"
[prometheus]
port = 9090
```
### Proving Keys
Proving Keys generated by the ZKsync stack must be downloaded from `https://pub-068f4ca2f03e4f21b6eb72b26008e90a.r2.dev/zksync-dev/data.tar.gz` and extracted on the host.
```
curl -O https://pub-068f4ca2f03e4f21b6eb72b26008e90a.r2.dev/zksync-dev/data.tar.gz
tar -xzvf data.tar.gz
```
### Execution
The docker image tag will be `latest-89` for L4 and `latest-86` for A10.
```
docker run \
--restart=always
--runtime=nvidia --gpus all \
-e HEAVY_WVG=2 -e LIGHT_WVG=30 \
--mount type=bind,src=./config.toml,target=/app/config/config.toml \
--mount type=bind,src=./data,target=/data lagrangelabs/lpn-zksync-prover:latest-89
```