Installation
Get started with Midnight, whether you are here to use privacy-preserving applications or to build them. The installation process includes setting up the Lace wallet, obtaining test tokens, and configuring the development environment.
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 wallet for the Midnight network. It is currently only compatible with Google Chrome.
Verification: The Lace wallet icon appears in your Chrome toolbar.
Create your walletβ
Your wallet is protected by a seed phrase, which acts as your master key. Keep it secret and safe.
Write down your seed phrase on paper and store it in a secure, offline location. Never store it digitally or share it.
Verification: Your wallet dashboard opens, showing a 0 tDUST balance.
Get test tokens (tDUST)β
tDUST is the token used on the Midnight Testnet. It has no real-world value and is used for testing transactions and interacting with applications.
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 applications (DApps) that allow developers to express the amount of data protection that works for them.
Use the following command to install the pre-built binaries:
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/midnightntwrk/compact/releases/download/compact-v0.2.0/compact-installer.sh | sh
Update your shell PATHβ
Make sure the Compact binary is in your shell's PATH to run it from any directory. This is done automatically by the installer script. If you want to manually add the binary to your PATH, run the following command:
export PATH="$HOME/.compact/bin:$PATH"
After that, reload your shell configuration to apply the changes:
source ~/.zshrc # or source ~/.bashrc
Update the compiler versionβ
Update the compiler version to the latest version:
compact update
This will download the latest version of the Compact compiler and set it as the default version.
Verify the Compact installationβ
compact --version to print version of Compact.which compact to print installation path.compact --version # print version of Compact
which compact # print installation path
Verification: These commands return the Compact version number and 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):
- Get Docker here: https://www.docker.com/products/docker-desktop/
Run the proof serverβ
Use the following command to start the proof-server in your terminal:
docker run -p 6300:6300 midnightnetwork/proof-server -- midnight-proof-server --network testnet
This command occupies the terminal window while running.
Verification: The terminal displays logs indicating the server is running and listening at http://localhost:6300.
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 snippets.
Verification: You now see Compact Language Support extension in your installed VS Code extensions.
Your development environment is now configured. You are ready to start building privacy-preserving applications on Midnight.
Troubleshootβ
This section covers some of the issues you'll likely encounter when installing the development environment and how to resolve them.
Compact binary not foundβ
If you get the following 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.