Skip to main content
Version: Canary 🚧

Proof server

Midnight uses zero-knowledge (ZK) cryptography to enable shielded transactions and data protection. An essential element of this architecture is ZK functionality provided by a Midnight proof server, which generates proofs locally that will be verified on-chain. The information that a DApp sends to the proof server includes private data, such as details of token ownership or a DApp's private state. To protect your data, you should access only a local proof server, or perhaps one on a remote machine that you control, over an encrypted channel.

Run a Midnight proof server on your system in a Docker container. The Lace wallet Chrome extension (including the wallet) communicates with the proof server to invoke ZK functionality and generate ZK proofs for your transactions.

Install the proof server​

  1. In the prerequisites from the installation guide, you installed Docker and verified your access to the Midnight Testnet docker repo.

    • Using the terminal:

      docker search midnightnetwork
    • Or by searching midnightnetwork in the Docker Desktop search bar.

  2. To download the Docker image for the Midnight proof server:

    • Via the terminal:

      docker pull midnightnetwork/proof-server:latest

      If you need to run an older version of the proof-server, Replace latest with the required version of the proof server according to the release compatibility matrix.

    • Or by clicking pull in the search results of the Docker Desktop.

  3. You can verify the download's success by checking that the following command lists a proof server image.

    • Via the terminal:

      docker images | grep proof-server
    • Or by clicking >_ Terminal, clicking Enable Docker terminal and running the same command as above.

Start the proof server​

In the terminal, run the proof server with the following command:

docker run -p 6300:6300 midnightnetwork/proof-server -- midnight-proof-server --network testnet

You should see some output indicating that the server has started.

Stop the proof server​

To stop the proof server, simply exit the process you launched with docker run. For example, on most systems, you can type Ctrl-C to stop the process.

For the next step in this tutorial, the proof server must be running, so if you have stopped it, start it again now.

Your privacy​

The proof server exists to protect your privacy. It does not open any network connections; it simply listens on its assigned port for requests from your Chrome extension. One of the lines of output you may see from the proof server includes this text:

Targeting network: TestNet

This indicates that the instance you are running is configured appropriately to generate proofs that are valid on the Midnight Testnet. It does not indicate a network connection from the proof server to Testnet.

Please let the DevRel support team know if you have any privacy concerns regarding the proof server.

Set up proof server as a systemd service​

Optionally for Linux users, you might consider running the proof server as an automatic background process anytime you boot your machine.

  1. Create a new file for your systemd service, typically in the /etc/systemd/system/ directory. For example:
sudo nano /etc/systemd/system/midnight-proof-server.service
  1. Add the following contents.
[Unit]
Description=Midnight Network Proof Server
After=docker.service
Requires=docker.service

[Service]
ExecStart=/usr/bin/docker run -p 6300:6300 midnightnetwork/proof-server -- midnight-proof-server --network testnet
Restart=always
RestartSec=5

[Install]
WantedBy=default.target

Adjust the Description, ExecStart, and other parameters as needed.

  1. Reload systemd manager to apply changes.
sudo systemctl daemon-reload
  1. Start service.
sudo systemctl start midnight-proof-server # start service
  1. How to stop and get status of service.
sudo systemctl enable midnight-proof-server # stop service

sudo systemctl status midnight-proof-server # get status of service