How to Deploy a Moonbeam Full Node?
Picture of Sankalp Sharma
Sankalp Sharma
Single New Blog Page
Single New Blog Page
How to Deploy a Moonbeam Full Node?

It is established that nodes are a vital part of a blockchain to function efficiently, and a full node contains and maintains the entire transaction data on a blockchain. Running a full node on a Moonbeam network allows you to connect to the network, synchronize with the boot node, obtain access to RPC endpoints, author blocks on parachain, and more. 

Now, the question to be asked is what is Moonbeam exactly and how to deploy a Moonbeam full node? Let’s begin. 

What is Moonbeam? 

Moonbeam is often just considered as an EVM implementation, but it is more than that. It is a highly specialized L1 chain that mirrors Ethereum’s Web3 RPC, keys, accounts, subscriptions, and others. The platform extends Ethereum features by adding elements such as on-chain governance, staking, and cross-chain integrations. 

Now that you understand what a full node is and the benefits of deploying a full node using Moonbeam, let us learn about the system requirements for the setup and deployment the same. 

System Requirements

Running a parachain node is similar to a typical Substrate node, but some differences exist. A Substrate chain node is a bigger build because it contains code to run the parachain itself, sync the relay chain, and facilitate communication between the two. Moonbeam being a parachain, this build is quite large and may take over 30 min and require 32GB of memory.

The minimum system specifications recommended for running a node are: 

  • Operating System: Linux
  • RAM: 8GM minimum, but recommended requirement is 16 GB
  • Storage: 1TB (SSD) minimum
  • CPU: 8 Cores (Fastest per core speed)
  • Firewall: P2P port must be open to incoming traffic: Source: Any, Destination: 30333, 30334 TCP

Running Ports

  • P2P: 30333 (TCP)
  • RPC: 9933
  • WS: 9944
  • Prometheus: 9615

For all intents and purposes of this article, let us consider that your system has 16GB RAM and 1TB SSD storage, and let’s start installing and setting up packages on your machine.

Note: A mandatory prerequisite to setting up a Moonbeam full node is a working knowledge and experience of Linux, and experience with Rust is not necessarily needed. 

Getting Started

To start quickly without compiling the binary yourself, you can make use of the release binary. Run the following to get the latest release binary.  

wget https://github.com/PureStake/moonbeam/releases/download/v0.27.2/moonbeam

Run sha256sum moonbeam to check if you’ve downloaded the correct version in your terminal. If you have, you will get the output: 

05cba168277f22990e606bec390df0be912e1661f9315837451a134132b009c4

Setup the service

  1. To add a user without home directory,
adduser moonbeam_service --system --no-create-home <username>
  1. Create a directory to store the binary and data:
sudo mkdir /var/lib/moonbeam-data
  1. Move the downloaded binary to /var/lib/moonbeamdata
sudo mv ./moonbeam /var/lib/moonbeam-data
  1. Ensure to set the permissions and ownership accordingly for the local directory that stores the chain data:
sudo chown -R <username> /var/lib/moonbeam-data

Make sure you change the <username> with yours. 

Creating the Configure File.

To begin with, create the systemd configuration file.

Title the file as: /etc/systemd/system/moonbeam.service

[Unit]
Description="Moonbeam systemd service"
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=on-failure
RestartSec=10
User=<username>
SyslogIdentifier=moonbeam
SyslogFacility=local7
KillSignal=SIGHUP
ExecStart=/var/lib/moonbeam-data/moonbeam \
     --port 30333 \
     --rpc-port 9933 \
     --ws-port 9944 \
     --execution wasm \
     --wasm-execution compiled \
     --state-pruning=archive \
     --trie-cache-size 0 \
     --db-cache <ram-in-mb> \
     --base-path /var/lib/moonbeam-data \
     --chain moonbeam \
     --name "<nodename>" \
     -- \
     --port 30334 \
     --rpc-port 9934 \
     --ws-port 9945 \
     --execution wasm \
     --name="<nodename> (Embedded Relay)"

[Install]
WantedBy=multi-user.target

Note: replace <username>, <nodename>, <ram-in-mb>  And <ram-in-mb> should be 50% of your ram in MB. Meaning if you have 16000 MB of RAM, your value will be 8000. Replace <ram-in-mb> with just 8000 

And if you want to run your own app or run an RPC endpoint to connect a Polkadot.js app, use the flags –unsafe-rpc-external and/or —unsafe-ws-external to run the full node with external access to the RPC ports. You can run moonbeam –help to avail more details. 

Create the Configuration file

Register & start the service by running: 

sudo systemctl enable moonbeam.service
sudo systemctl start moonbeam.service

Now, verify the service by running:

sudo systemctl status moonbeam.service

And that’s it. You have successfully set up your first Moonbeam full node

Check the logs by executing:

journalctl -f -u moonbeam.service

For any reason if you want to stop the service, you can run:

sudo systemctl stop moonbeam.service

Wrapping Up

After the full node setup, make the most of Moonbeam’s full EVM implementation, and develop the dApps or smart contracts you desire. Now, Moonbeam network support is available on Zeeve, an industry leader in military-grade secure node operation and shared APIs, with excellent uptime and performance. 

So what are you waiting for? Book a free developer consultation today, and make the most of Zeeve’s products & services.

Share

Recent blogs
Join the Our Largest
community!

Be one of the 15,000+ innovators who
subscribe to our updates.

graphic (1)
Subscribe to Zeeve Newsletter!

Get our latest news, announcements, and other value-packed insights straight to your inbox, join our 30000+ subscribers newsletter.

Please enable JavaScript in your browser to complete this form.
Blog page graphic