Skip to content

Compile the Moonbeam Binary

Full Node Moonbeam Banner

Introduction

There are several ways to get started running a full node on the Moonbeam network. This guide goes through the process of compiling the Moonbeam binary from Rust source code. For a more general overview of running nodes, or to get started with Docker, check out the Run a Node page of our documentation.

This guide is meant for people with experience compiling Substrate based blockchain nodes. A parachain node is similar to a typical Substrate node, but there are some differences. A Substrate parachain node will is a bigger build because it contains code to run the parachain itself, as well as code to sync the relay chain, and facilitate communication between the two. As such, this build is quite large and may take over 30 min and require 32GB of memory.

Compiling the Binary

The following commands will build the latest release of the Moonbeam parachain.

First, let's start by cloning the moonbeam repo.

git clone https://github.com/PureStake/moonbeam
cd moonbeam

Let's check out the latest release:

git checkout tags/$(git describe --tags)

If you already have Rust installed, you can skip the next two steps. Otherwise, install Rust and its prerequisites via Rust's recommended method by executing:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Next, update your PATH environment variable by running:

source $HOME/.cargo/env

Lastly, build the parachain binary:

cargo build --release

Compiling Binary

If a cargo not found error shows up in the terminal, manually add Rust to your system path or restart your system:

source $HOME/.cargo/env

Now you can use the Moonbeam binary to run a systemd service.