Skip to main content
Version: Canary 🚧

Windows Compact Setup

This guide covers setting up the Midnight development environment on Windows using Windows Subsystem for Linux (WSL). We'll walk you through the essential setup steps, including installing and configuring WSL, Docker Desktop, and the Midnight Lace wallet.

By the end of this tutorial, you'll have a development-ready environment for building DApps on the Midnight Network, running the proof server, and interacting with the network.

Install Ubuntu​

Developing DApps for the Midnight network often requires compiling and running various components (like the proof server or complex scripts) that are traditionally Linux-based. The Windows Subsystem for Linux (WSL) is a critical component that allows you to run a native Linux environment directly within Windows without the overhead of a traditional virtual machine.

Step-by-step installation:

Open the Start Menu on your Windows desktop.

Search for Windows PowerShell (or Command Prompt) and right-click on the result. Select Run as administrator. This elevation is necessary to install system-level features like WSL.

![Windows Start menu with PowerShell right-click menu showing Run as administrator

In the command terminal, enter the following streamlined installation command:

wsl --install -d ubuntu

PowerShell terminal executing the wsl installation command

This command performs three primary functions automatically: It enables the required Windows features for WSL (Virtual Machine Platform and Windows Subsystem for Linux). It downloads and installs the recommended Ubuntu distribution (the default and most widely supported Linux environment).

Ubuntu distribution download and installation progress in the terminal

It restarts the necessary services.

info

The initial download and installation of the required components and the Ubuntu image can take anywhere from 5 to 15 minutes, depending on your internet connection and system speed. Do not close the window until the process is complete.

After the installation process completes, a new Ubuntu terminal window will open automatically. You will be prompted to create a UNIX username and a password.

Ubuntu terminal prompt for creating a new UNIX username and password

note

When entering your password, the characters will not be displayed on the screen for security reasons (this is standard Linux terminal behavior). Type your desired password carefully and press Enter.

Once successfully configured, your new username will be displayed as part of your terminal prompt (for example, yourusername@DESKTOP-XXXXXX:~$).Β 

![Ubuntu terminal showing the successful configuration and user prompt

This confirms that WSL is correctly installed and the Ubuntu distribution is ready for use.

Verification and best practices​

To ensure WSL is running the correct version, you can execute this command in the Windows PowerShell:

wsl -l -v

You should see a list showing Ubuntu and confirming its STATE is Running (or Stopped) and its VERSION is 2 (WSL 2 is required for optimal performance and Docker integration).

Install and configure Docker desktop​

Open your preferred web browser and navigate to the official Docker website at docker.com/products/docker-desktop.

Official Docker Desktop download page for Windows

Look for the Docker Desktop for Windows download link. Ensure you download the installer that matches your CPU architecture (for example, Windows - AMD64 for modern systems).

Run the downloaded installer (for example, Docker Desktop Installer.exe). During the installation, make sure the box for Use WSL 2 instead of Hyper-V is checked. This is vital for Docker to integrate seamlessly with the Linux environment you just set up.

Follow the prompts to complete the installation. A system restart may be required.

After the reboot, launch Docker Desktop from your Start Menu. It will take a few moments to start up, showing the whale icon in your system tray.

Verification and integration​

Once Docker Desktop is running, open the Settings menu (the gear icon).

Click Resources, then navigate to the WSL integration tab.

Ensure that the Enable integration with my default WSL distro option is toggled ON, and specifically verify that your Ubuntu distribution is enabled. This connection allows Docker to manage containers directly from your Linux terminal.

Set up and run the midnight proof server​

The Midnight Proof Server is the core component that your DApps will communicate with to execute zero-knowledge proofs and transactions. It is run via Docker for consistency.

Downloading the Docker image​

Open your Docker Desktop application and navigate to the Explore section (or use the search field at the top). Search for midnightnetwork/proof-server and download the latest image.

Docker Desktop Images tab showing the downloaded proof-server image

Running and configuring for testnet​

When you click Run within Docker Desktop, the proof server starts, but it defaults to targeting a local, private network configuration. To connect to the Midnight Testnet, you must run the container with the correct environment variables.

Instead of using the Docker Desktop UI to start the container, open your Ubuntu terminal and execute the following command:

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

Docker container run settings showing default configuration

To make it useful for development, we must explicitly configure it to connect to the Midnight Testnet.

Return to the Midnight Developer documentation.

Navigate to the relevant tutorial: Midnight Developer Tutorial > Tutorial 1.3 Proof Server.

Scroll down to the Start the proof server sub-section. The documentation provides a specific command optimized for connecting to the Testnet. Copy this exact command. It will look similar to a standard docker run command but with specific environment flags attached.

Midnight documentation showing the optimized proof-server run command

Open Windows PowerShell (or your WSL terminal, if preferred).

Paste the command you copied in the previous step and press Enter.

Terminal window showing the proof-server successfully running on the Midnight Testnet

This command will instruct Docker to launch the proof server container, map the necessary ports, and most importantly, set the environment variables that force it to target the public Midnight Testnet nodes.

Install the Compact compiler​

Compact is Midnight's smart contract language. Since you are using a Windows machine, you must install the compiler inside your WSL Ubuntu terminal to ensure it works with the rest of the Midnight toolchain.

  1. Open your Ubuntu terminal (WSL).
  2. Run the following command to install the Compact binaries:
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/midnightntwrk/compact/releases/download/compact-v0.4.0/compact-installer.sh | sh

  1. The installer script automatically updates your path. To apply these changes to your current session, reload your shell configuration:
source ~/.bashrc

  1. Verify the installation by checking the version:
compact --version

  1. Update to the latest version to ensure you have the most recent features:
compact update

Install the Compact VS Code extension​

The Compact VS Code extension provides syntax highlighting and real-time error checking, which is essential for writing smart contracts.

  1. Download the latest VSIX package from the Compact VS Code extension release page.
  2. Open VS Code.
  3. Go to the Extensions view (press Ctrl+Shift+X), click the ... (More Actions) menu at the top-right of the extensions pane, and select Install from VSIX....
  4. Select the .vsix file you just downloaded to complete the installation.

Conclusion​

Congratulations! You've successfully setup Midnight's development tools on your Windows machine using WSL.

Now that your environment is ready, you can begin building. Head over to the Compact documentation to start writing your first smart contracts using the Compact programming language.