How to Set Up and Run the MultiversX Node with Go

Jan 30, 2024 | Blockchain

Welcome to this user-friendly guide on how to install and run the MultiversX node using the Go programming language. Whether you aim to participate as an observer or become a validator in the network, this article will walk you through the essentials step-by-step.

Getting Started: Prerequisites

Before diving into the installation process, ensure you have the minimum Go version 1.17.6 installed on your machine. You can follow the official Golang installation guide to get started.

Installation Steps

  • Step 1: Install and Configure Go

    Begin by following the official Go installation guide to set up Go on your system.

  • Step 2: Clone the Repository and Build the Binaries

    Here’s where things get interesting! Picture a chef preparing a meal: you need to gather your ingredients (clone the repository) and then cook (build the binaries). Here’s how:

    
    $ if [[ $GOPATH == "" ]]; then GOPATH=$HOME/go; fi
    $ mkdir -p $GOPATH/src/github.com/multiversx
    $ cd $GOPATH/src/github.com/multiversx
    $ git clone https://github.com/multiversx/mx-chain-go
    $ cd mx-chain-go
    $ git checkout master
    $ cd cmd/node
    $ go build
            

    This sequence ensures you have all the necessary components ready to cook up your node!

  • Step 3: Create Node Identity

    Every chef has their signature dish, and your node needs a distinct identity for the MultiversX Network:

    
    $ cd $GOPATH/src/github.com/multiversx/mx-chain-go/cmd/keygenerator
    $ go build
    $ ./keygenerator
            
  • Step 4: Join the MultiversX Network

    • Option A: Join the Testnet

      Follow the steps outlined here to join the testnet.

    • Option B: Start a Node in a Separate Network

      Copy the generated .pem file to the directory where the node binary is located:

      
      $ cp validatorKey.pem /path/to/nodeconfig
      $ cd /path/to/node
      $ ./node
                      

      Your node is now ready to start serving its purpose.

Running the Tests

To ensure everything is functioning correctly, you can run tests on your setup:


$ go test ...

Compiling New Fields in .proto Files

Your setup might require additional components, similar to a chef adjusting a recipe. Follow these steps to compile new fields:

  • Download the protoc compiler.
  • Expand it, and copy the include/google folder to /usr/include.
  • Copy the protoc binary to /usr/bin.
  • Fetch the repo github.com/multiversx/protobuf and compile gogo slick using:
  • 
    $ cd protoc-gen-gogo/slick
    $ go build
    $ sudo cp protoc-gen-gogo/slick /usr/bin
        

Running P2P Prometheus Dashboards

To monitor your node’s performance, run it with metrics collection enabled:


$ ./node --p2p-prometheus-metrics

You can now access the metrics collection at http://localhost:8080/debug/metrics/prometheus.

Troubleshooting

Should you encounter any issues during installation or running your node, consider the following troubleshooting steps:

  • Check if your Go version is compatible. The minimum required version is 1.17.6.
  • If you’re having issues with cloning the repository, ensure you have adequate permissions or check your internet connection.
  • For any problems related to identity creation and configurations, revisit the paths and filenames to ensure they are correct.
  • Review your flags and configurations when starting the node; using the --help flag can provide additional insights.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Final Thoughts

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox