Skip to content

Manually Compile the Moonbeam Binary

Introduction

Running a full node on a Moonbeam-based network allows you to connect to the network, sync with a boot node, obtain local access to RPC endpoints, author blocks on the parachain, and more.

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 be 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 minutes, and requires 32GB of memory.

To get started quickly without the hassle of compiling the binary yourself, you can use The Release Binary.

Compile the Binary

Manually compiling the binary can take around 30 minutes and requires 32GB of memory.

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

  1. Clone the Moonbeam repo

    git clone https://github.com/moonbeam-foundation/moonbeam
    cd moonbeam
    
  2. Check out to the latest release

    git checkout tags/$(git describe --tags)
    
  3. If you already have Rust installed, you can skip the next two steps. Otherwise, install Rust and its prerequisites via Rust's recommended method

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    
  4. Update your PATH environment variable

    source $HOME/.cargo/env
    
  5. Build the parachain binary

    Note

    If you are using Ubuntu 20.04 or 22.04, then you will need to install these additional dependencies before building the binary:

    apt install clang protobuf-compiler libprotobuf-dev pkg-config libssl-dev -y 
    
    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. To set up the service and run it, please refer to the Run a Node on Moonbeam Using Systemd guide.

Last update: May 28, 2024
| Created: November 17, 2021