Skip to main content
Version: v1

Install the toolchain

Get started with Midnight, whether you are here to use privacy-preserving applications or to build them. This guide covers wallet setup for all users, and additional development tools for builders.

For users, you will install the Lace Midnight Preview wallet, Docker Desktop to run the proof server, and obtain test tokens. For developers, you will also install the Compact toolchain, and run the proof server.

Prerequisites

Before you begin, ensure you have:

  • Google Chrome browser installed
  • Basic familiarity with command-line operations
  • Administrative privileges on your computer (for installing Docker and Compact)

Install the Lace Midnight Preview wallet

This section walks you through the process of installing the Lace Midnight Preview wallet, creating a new wallet, and getting test tokens.

Download and install the Lace wallet extension

Lace Midnight Preview wallet is a browser extension for the Midnight Network. It is currently only compatible with Google Chrome. Here's how to install it:

1
Open the Google Chrome browser.
2
Install the Midnight Lace wallet extension from the Chrome Web Store.
3
Click Add to Chrome and confirm by clicking Add extension.
4
Pin the extension to your toolbar for easy access (recommended).

Verification: The Lace wallet icon appears in your Chrome toolbar.

Create your wallet

To create a new wallet, follow these steps:

1
Click the Lace wallet icon in your browser's toolbar.
2
Select the Create button to create a new wallet.
3
Copy the seed phrase to your clipboard, and then click Next to continue.
Seed phrase

warning

Write down your seed phrase on paper and store it in a secure, offline location. Never store it digitally or share it.

4
Paste the seed phrase into the confirmation field, and then click Confirm to complete the setup.
5
Enter your wallet name, choose a strong password, and click Next to continue.

Wallet name

6
Choose your network and proof server address.

Enter wallet

7
Click Enter wallet to complete the setup.

Verification: Your wallet dashboard opens, showing your shielded and unshielded wallet addresses.

Get test tokens (tDUST)

tDUST is the network resource used to process transactions and interact with DApps on the Midnight Network. It has no real-world value and is used for testing transactions and interacting with DApps.

1
In your Lace wallet, click Receive, and then copy your Unshielded wallet address.
Unshielded wallet address
2
Go to the Preprod Faucet: https://faucet.preprod.midnight.network/.
3
Paste your address into the form and click Request tokens. Wait a few minutes for the tokens to arrive.
4
Once the tokens are received, you must delegate them to your wallet to generate tDUST. Click Generate tDUST and select your wallet address.
tDUST balance
5
Click Review transaction to proceed, and then select Confirm to submit the transaction.
Generate tDUST
6
Once the transaction is confirmed, you'll see your tDUST balance in your Lace wallet.

Verification: Your Lace wallet shows a new balance of tDUST tokens.

You are now ready to interact with DApps. To start building on Midnight, continue with these additional setup steps for the development environment.

Install Compact

This section walks you through the process of installing the Compact compiler and setting a default compiler version.

Install Compact using the installer script

Compact is Midnight's dedicated smart contract language for creating decentralized applications (DApps) that allows developers to control the level of data protection in their applications.

Use the following command to install the pre-built binaries:

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/midnightntwrk/compact/releases/latest/download/compact-installer.sh | sh

Update your shell PATH

The installer script automatically adds Compact to your shell's PATH. However, you need to restart your terminal or reload your shell configuration for the changes to take effect.

To reload your shell configuration without restarting, run the following command:

source ~/.zshrc # for zsh
# or
source ~/.bashrc # for bash

Manual PATH configuration (only if needed): If Compact is not found after restarting, manually add it to your PATH:

export PATH="$HOME/.compact/bin:$PATH"

Then reload your shell configuration as shown above.

Update the compiler version

Update to the latest compiler version:

compact update

This command downloads the latest version of the Compact compiler and sets it as the default version.

Verify the Compact installation

Run these commands to verify your installation:

compact --version # print the version of Compact
compact compile --version # print the version of the compiler
which compact # print the installation path

Verification: These commands return the Compact version number, the compiler version number, and the installation path.

Set up the proof server

This section walks you through the process of installing Docker Desktop and running the proof server.

Install Docker Desktop

The proof server is required to generate zero-knowledge proofs for transactions locally. It runs as a background service using Docker.

If you don't have Docker, download and install Docker for your operating system (macOS, Windows, or Linux):

Run the proof server

Use the following command to start the proof-server in your terminal:

docker run -p 6300:6300 midnightntwrk/proof-server:7.0.0 -- midnight-proof-server -v

This command occupies the terminal window while running.

Verification: The terminal displays logs indicating the server is running and listening at http://localhost:6300.

note

To use a local proof-server with Lace Midnight Preview wallet, go to Settings » Midnight and select Local (http://localhost:6300).

Install the Compact VS Code extension

The Compact VS Code extension provides helpful syntax highlighting and code snippet completion. To install it, follow these steps:

1
Download the VSIX package.
2
In VS Code, go to Extensions, then Install from VSIX and select the extension file.

Verification: You now see the Compact Language Support extension in your installed VS Code extensions.

Your development environment is now configured. You are ready to start building and interacting with privacy-preserving applications on Midnight.

Troubleshoot

This section covers common issues that you might encounter during installation and their solutions.

Compact binary not found

If you see this error:

compact: command not found

This means the Compact binary is not in your PATH. Follow the instructions in Update your shell PATH to add it to your PATH.

Docker Desktop not running

If you encounter connection errors when starting the proof server, ensure Docker Desktop is running:

  1. Open Docker Desktop application.
  2. Wait for the Docker engine to start (the Docker icon in your system tray should be steady, not animated).
  3. Try running the proof server command again.

Port already in use

If you see an error that port 6300 is already in use:

Error: bind: address already in use

Either stop the process using port 6300, or run the proof server on a different port:

docker run -p 6301:6300 midnightntwrk/proof-server:7.0.0 -- midnight-proof-server -v

Remember to update your application configuration to use the new port.

Next steps

Now that your development environment is set up, you can: