How to Run a Shardeum Validator Node on GCP

How to Run a Shardeum Validator Node on GCP

Learn how to set up a Shardeum Node on Google Cloud Platform (GCP) and earn rewards, SHM token airdrops, NFTs, and more...

·

4 min read

Exciting news for blockchain enthusiasts and potential node runners as Shardeum has just announced Stage 2 of its incentivized testnet program, which rewards node runners. This presents a really good opportunity for you to contribute to the network's development and potentially earn rewards.

Outside the rewards that your nodes earn while they’re participating in the Shardeum network, a sizable amount of SHM tokens (5%) has been reserved for ecosystem distribution and airdrops. This pool will reward betanet users like yourself who will be helping the network in its early stages.

Enough background, let’s jump right in. In this guide, we'll walk through the process of setting up a Shardeum validator node on Google Cloud Platform (GCP).

Gotchas

It's important to note that this process will require you to run a VM instance on GCP which costs around $25 a month. However, your node will earn token rewards while participating in the network and you stand a chance to receive a significant portion of the airdrop distribution on mainnet.

If you’d like to instead run a node locally on your machine which would cost you nothing, you can find the documentation here.

Setting Up Your Shardeum Validator Node

Now, let's get into the process of setting up your validator node on GCP. This is mostly for those who may not have the required system specifications to run the node locally on their machines.

Google Cloud Platform (GCP) Setup:

  1. Create a GCP account at https://cloud.google.com/

  2. In the GCP Console, go to "Compute Engine" > "VM instances"

  3. Create a new instance with the following specs:

    • Choose e2-medium (2 vCPU, 4 GB memory) or higher

    • Select Ubuntu 20.04 LTS as the operating system with 20GB storage

    • Allow HTTP and HTTPS traffic

  4. Connect to your VM instance using the SSH button in the GCP console

  5. This will open a new tab for you to access your ssh terminal to run commands

    • First, make sure your package manager is up-to-date, then install curl:

    •   sudo apt update
        sudo apt-get install curl
      
  • Next install docker in the instance:

    •   sudo apt install docker.io
      
  • After the installation of Docker is complete, run this command to install Docker Compose

    •   sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
        sudo chmod +x /usr/local/bin/docker-compose
      
  1. Now that we have both Docker and Docker compose, run the following commands to download and install the Shardeum validator:

     curl -O https://raw.githubusercontent.com/shardeum/validator-dashboard/dev/installer.sh && chmod +x installer.sh && ./installer.sh
    

    The installer will ask you the following setup questions:

    1. Collect Validator Data: Agree to allow the Shardeum team to collect data for bug reporting by entering y.

    2. Run the Web-Based Dashboard: Enter y to set up the web-based dashboard.

    3. Set Dashboard Password: Create a password for accessing the dashboard.

    4. Set Dashboard Port: Enter the desired port for the dashboard or press enter to use the default port 8080.

    5. Set External IP Address: Press enter to use the automatically detected IP address (the IP of your VM instance) or enter a custom IP address.

    6. Set Internal IP Address: Press enter to use the automatically detected IP address or enter a custom IP address.

    7. Set P2P Ports: Enter the first port (default is 9001) and the second port (default is 10001) for P2P communication.

    8. Set Installation Directory: Press enter to use the default installation directory (~/.shardeum).

Open Necessary Ports

By default, your VM will be behind a firewall, make sure to forward the P2P communication ports (9001 and 10001) and the web based dashboard port 8080 to your VM's IP address. To do that, run the following commands:

sudo ufw allow 9001/tcp
sudo ufw allow 10001/tcp
sudo ufw allow 8181/tcp
sudo ufw reload

Alternatively, you can manually set it up on the GCP Console following these steps:

  • Go to the Google Cloud Console.

  • Navigate to "VPC Network" > "Firewall rules".

  • Create a new firewall rule:

  • Name: allow-8181

  • Targets: All instances in the network

  • Source IP ranges: 0.0.0.0/0

  • Protocols and ports: tcp:9001

  • Repeat the process to create a firewall rules for ports 10001 and 8080.

Run the validator

Now, change directory into the shardeum directory where the validator is installed, and start the validator:

cd ~/.shardeum

./shell.sh

operator-cli start

Verify Access

Open a web browser and navigate to the Shardeum dashboard on the port you’ve specified during the setup process. You will be required to provide your password which you also set during that setup process.

https://<YOUR_VM_EXTERNAL_IP>:8080

From here on, you can follow the steps documented in the Shardeum validator docs to connect your wallet, stake your node and have it participate in the Shardeum network. You can see the rewards your Node earns on the dashboard amongst other details for you to explore.

I hope this has been helpful and if you have any questions or want to stay in touch, join us on the Shardeum Discord server!

Remember to stay updated with official Shardeum communications for any changes or additional instructions during the Stage 2 campaign.

Good luck, and may your nodes run smoothly!