šŸŒ0G: Setting Up Your Validator Node

ilaNihas šŸŒ
15 min readApr 13, 2024
Ā© by 0G

UPDATE [April 25, 2024]: It appears that the 0g-evmos repository has been removed, making it no longer possible to set up the 0g-evmos node. However, you might consider setting up a 0g-storage-node instead. As I donā€™t currently have a guide for this, I recommend consulting the official documentation available here: 0g-storage-node Setup Documentation

After a brief break, Iā€™m back exploring exciting cryptocurrency projects, and today Iā€™m introducing 0G, short for ZeroGravity, a project thatā€™s developing a modular AI blockchain designed to transform AI dApps. This platform offers an easy-to-use environment for developers by using a scalable Data Availability (DA) layer that separates data handling into two parts: data publishing and data storage. This setup helps avoid bottlenecks and ensures that large data volumes can be managed efficiently and securely.

0G stands out because it has a scalable system that doesnā€™t just store data but also ensures it is easily accessible for anyone who needs it. This is important for applications that rely on fast and reliable data retrieval, such as AI technologies and advanced Layer 2 networks.

The system works by allowing nodes to earn rewards not just for storing data but for proving that data is accessible when needed. This encourages nodes to perform well and helps the network scale effectively. 0G also supports a variety of data types, thanks to its multi-layer storage system that includes both unstructured and structured data management.

Basically 0G.ai is not just creating a data storage solution; itā€™s enhancing the accessibility and usability of data in blockchain applications, making it an exciting project to watch in the growing landscape of Web3 and decentralized technologies.

0G Labs, the team behind 0G.ai, has successfully raised $35 million in a pre-seed funding round with support from notable investors like Alliance, Animoca Brands, Delphi Digital, Samsung Next, Symbolic Capital, and OKX Ventures. This funding highlights the strong interest and confidence in the projectā€™s potential.

The project has already launched its Newton Testnet on April 10th, allowing for testing and further development. 0G Labs is also preparing for a significant step forward with the planned launch of its Mainnet in the third quarter of 2024, which will bring the platform fully online.

Ā© by ICOAnalytics

Step 1: Order And Configure Your VPS

To get started with installing your node, youā€™ll first need to rent a VPS (Virtual Private Server). Using a VPS offers several advantages, such as enhanced performance, scalability and reliability. Iā€™ll guide you through the process of renting a VPS at a lower cost, and show you how to configure it. Follow the steps below to get your VPS ready for the node installation.

Research VPS providers: Take some time to explore different VPS providers available in the market. Consider factors like pricing, reputation, and customer reviews to find the right fit for your needs. Look for plans that offer the appropriate amount of resources (CPU, RAM, storage) to support your node. Contabo is my preferred choice due to their combination of affordable pricing, reliable performance, and user-friendly interface.

I personally use and trust Contabo for my blockchain nodes. Iā€™ve recently joined their affiliate program to recommend their services. If you decide to use my affiliate links for Contabo, youā€™ll be supporting my work at no extra cost to you. This support is important for continuing our journey together in the fascinating world of crypto, and using these affiliate links is a direct and impactful way to back my efforts. Thank you very much for your support!

Minimum hardware specifications needed for this node:

4 CPU Cores
8 GB+ RAM
400 GB SSD Storage

In setting up the node, weā€™ll follow the recommended hardware guidelines and choose the Cloud VPS 2 package.

I will initially select a rental period of 1 month, with the flexibility to extend it later if needed:

Make sure to choose the option ā€œEuropean Union (Germany)ā€:

For the best storage solution, I recommend selecting the 400GB SSD storage type:

Navigate to either the ā€œPopularā€ or ā€œOSā€ tab and choose the standard Ubuntu 20.04 image from there:

To prioritize security, I highly recommend to generate a password and securely store it to ensure maximum protection:

For the final step, itā€™s recommended to leave the sections titled ā€œObject Storageā€, ā€œNetworkingā€, and ā€œAdd-Onsā€ in their default state without any modifications. If you are new to Contabo, please create an account; otherwise, login using your existing credentials. Provide your personal data by filling in the required fields. Complete the remaining fields with your personal information, and click the ā€œNextā€ button to proceed with the payment. After successfully completing the payment for your order, you will receive an initial email. Within approximately 15ā€“30 minutes, you will receive a second email containing all the information needed to connect to your VPS.

Step 2: Connect To Your VPS via SSH

Download and install most recent edition of PuTTY by visiting the official website:

You will find the IP adress of your VPS in the second email. Launch PuTTY, enter the IP address of your VPS and click ā€œOpenā€:

Once the server interface is open, you will be prompted to provide login details; simply enter ā€œrootā€ as the user and use your chosen password:

Congratulations! You are now successfully logged into your server:

Step 3a: Preparations ā€” Update Packages

To continue, we can update the packages by running the following commands in the terminal. The first part of the command updates the package lists for upgrades, and the second part actually performs the upgrades with the ā€œ-yā€ flag allowing for automatic confirmation of prompts during the upgrade process:

sudo apt update && sudo apt upgrade -y

Step 3b: Preparations ā€” Install Build Tools

In this step, weā€™re preparing the system by installing essential build tools. Specifically, curl and git are used for downloading and managing code repositories, jq for processing JSON data, lz4 for compression and decompression, and build-essential for compiling software from source etc.

sudo apt install curl git wget htop tmux build-essential liblz4-tool jq make lz4 gcc unzip -y

Step 4: Install GO

Make sure you install the latest version of GO, whether itā€™s a fresh installation or an update:

ver="1.22.2"
wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz"
rm "go$ver.linux-amd64.tar.gz"
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
source $HOME/.bash_profile

Step 5: Download And Build Binaries

To install the latest version of the 0G-evmosd project from 0G Labs, youā€™ll first need to download the projectā€™s source code from GitHub and then compile it:

# Clone the project repository:
cd $HOME
git clone https://github.com/0glabs/0g-evmos.git
cd 0g-evmos

Check the releases page to see if there is a newer version than v1.0.0-testnet. If there is, replace v1.0.0-testnet with the latest version in the following command:

# Checkout version:
git checkout v1.0.0-testnet

# Build the Binaries:
make build

Step 6: Organize the Build for Deployment

Once youā€™ve built the binaries for the 0G-evmosd project, youā€™ll need to organize them for use with Cosmovisor, a process manager for Cosmos SDK applications:

# Create the directory structure:
mkdir -p $HOME/.evmosd/cosmovisor/genesis/bin

# Move the compiled evmosd binary into the directory:
mv build/evmosd $HOME/.evmosd/cosmovisor/genesis/bin/

# After moving the binary, clean up the build directory:
rm -rf build

These steps ensure that your0G-evmosd binary is properly stored and managed for easy upgrades and maintenance using Cosmovisor. This setup helps in simplifying the update process and keeping your node operational with minimal downtime.

Step 7: Set Up Symbolic Links for Easy Access

To ensure the 0G-evmosd binary is easily accessible and managed effectively with Cosmovisor, we will create symlinks. These links will help in switching versions and managing the binary execution paths more efficiently:

# Link the Genesis to Current Directory:
sudo ln -s $HOME/.evmosd/cosmovisor/genesis $HOME/.evmosd/cosmovisor/current -f

# Link the Binary to System Path
sudo ln -s $HOME/.evmosd/cosmovisor/current/bin/evmosd /usr/local/bin/evmosd -f

Step 8: Install Cosmovisor

Cosmovisor is a important tool for managing updates and processes for Cosmos SDK applications like 0G-evmosd. It ensures seamless upgrades by automatically restarting the application with the new version without manual intervention:

go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@latest

Step 9: Configure System Service for 0G-evmosd

To ensure that your0G-evmosd node runs as a resilient and automatically restarting service, it's effective to configure it using systemd, a system and service manager for Linux operating systems. This setup allows the 0G-evmosd node to start at boot and keep running even if it encounters errors:

sudo tee /etc/systemd/system/evmosd.service > /dev/null << EOF
[Unit]
Description=evmosd node service
After=network-online.target

[Service]
User=$USER
ExecStart=$(which cosmovisor) run start
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
Environment="DAEMON_HOME=$HOME/.evmosd"
Environment="DAEMON_NAME=evmosd"
Environment="UNSAFE_SKIP_BACKUP=true"
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:$HOME/.evmosd/cosmovisor/current/bin"

[Install]
WantedBy=multi-user.target
EOF

To finalize the setup and ensure your0G-evmosd node service is operational and configured to start automatically when your system boots, follow these steps:

sudo systemctl daemon-reload
sudo systemctl enable evmosd.service

Step 10: Configuring Your Node

To configure your node for operation, youā€™ll need to set several parameters. This involves specifying the chain ID, keyring backend, and the node endpoint. These commands are important for properly configuring your node to interact with the network, manage keys securely, and communicate with other nodes effectively:

# Set the chain ID:
evmosd config chain-id zgtendermint_9000-1

# Configure the keyring backend:
evmosd config keyring-backend os

# Set the node endpoint:
evmosd config node tcp://localhost:16457

Step 11: Initializing Your Node

To start setting up your node, we need to initialize it with a specific node name and chain ID. Before running the command, decide on a unique name for your node. This name will identify your node within the network. Replace YOUR_NODE_NAME with the actual name youā€™ve chosen for your node:

evmosd init YOUR_NODE_NAME --chain-id zgtendermint_9000-1

This command sets up the basic configuration for your node, including generating the necessary directories and files for operation. The --chain-id parameter ensures that your node is set up to connect to the specific blockchain network identified as zgtendermint_9000-1.

Step 12: Downloading and Setting Up the Genesis File

The genesis file is a fundamental component of any blockchain network. It contains the initial configuration and state of the blockchain. For your node to correctly join and sync with the specified network, we need to download and place the genesis file in the correct directory:

curl -Ls https://github.com/0glabs/0g-evmos/releases/download/v1.0.0-testnet/genesis.json > $HOME/.evmosd/config/genesis.json

After downloading the genesis file, itā€™s good practice to check that the file is not corrupted and is correctly placed. If the genesis file has been downloaded correctly and is complete, you can exit the text editor by pressing CTRL + X:

nano $HOME/.evmosd/config/genesis.json

Step 13: Configuring Network Peers and Ports

To fully integrate your node into the network and configure it for proper communication, weā€™ll need to update its configuration with the correct peers, seeds, and port numbers:

  • Set Peers and Seeds: To ensure your node can connect to and communicate with other nodes in the network, weā€™ll update the config.toml file with the appropriate peer and seed information. Peers are nodes that your node will directly connect to for information and syncing. Seeds are special peers that provide information about other peers in the network to help your node find and connect to active peers.
PEERS="1248487ea585730cdf5d3c32e0c2a43ad0cda973@peer-zero-gravity-testnet.trusted-point.com:26326"
SEEDS="8c01665f88896bca44e8902a30e4278bed08033f@54.241.167.190:26656,b288e8b37f4b0dbd9a03e8ce926cd9c801aacf27@54.176.175.48:26656,8e20e8e88d504e67c7a3a58c2ea31d965aa2a890@54.193.250.204:26656,e50ac888b35175bfd4f999697bdeb5b7b52bfc06@54.215.187.94:26656"

sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.evmosd/config/config.toml
  • Update Gas Prices: Itā€™s essential to set the minimum gas prices to prioritize transactions during high network activity. Update this in the app.toml file:
sed -i "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.00252aevmos\"/" $HOME/.evmosd/config/app.toml
  • Modify Network Port Configurations: To customize or avoid port conflicts, you might need to change the default port settings in both config.toml and app.toml. This includes ports for various services such as the RPC server, P2P layer, and Prometheus for monitoring:
sed -i -e "s%^proxy_app = \"tcp://127.0.0.1:26658\"%proxy_app = \"tcp://127.0.0.1:16458\"%; s%^laddr = \"tcp://127.0.0.1:26657\"%laddr = \"tcp://127.0.0.1:16457\"%; s%^pprof_laddr = \"localhost:6060\"%pprof_laddr = \"localhost:16460\"%; s%^laddr = \"tcp://0.0.0.0:26656\"%laddr = \"tcp://0.0.0.0:16456\"%; s%^prometheus_listen_addr = \":26660\"%prometheus_listen_addr = \":16466\"%" $HOME/.evmosd/config/config.toml
sed -i -e "s%^address = \"tcp://localhost:1317\"%address = \"tcp://0.0.0.0:16417\"%; s%^address = \":8080\"%address = \":16480\"%; s%^address = \"0.0.0.0:9090\"%address = \"0.0.0.0:16490\"%; s%^address = \"0.0.0.0:9091\"%address = \"0.0.0.0:16491\"%; s%:8545%:16445%; s%:8546%:16446%; s%:6065%:16465%" $HOME/.evmosd/config/app.toml

Step 14: Backing up Important Data And Installing Necessary Tools

Before making changes like a reset, itā€™s important to backup the validator state. This file contains the state of your nodeā€™s validator at the last block it signed:

# Stop sevrice:
systemctl stop evmosd

# Backup validator state:
cp $HOME/.evmosd/data/priv_validator_state.json $HOME/.evmosd/priv_validator_state.json.backup

# Clear all blockchain data except address book:
evmosd tendermint unsafe-reset-all --home $HOME/.evmosd --keep-addr-book

Download the latest blockchain state from a snapshot to quickly sync your node up to a recent block. This command streams a compressed snapshot file and extracts it directly into your .evmosd directory:

curl -L http://37.120.189.81/0g_testnet/0g_snap.tar.lz4 | tar -I lz4 -xf - -C $HOME/.evmosd

After the snapshot is extracted and your node data is essentially reset, restore your original validator state to avoid any potential issues with block signing:

mv $HOME/.evmosd/priv_validator_state.json.backup $HOME/.evmosd/data/priv_validator_state.json

To make sure that your service is updated with any configuration changes and is running smoothly, follow these steps:

sudo systemctl daemon-reload
sudo systemctl restart evmosd

Many thanks to the Core Node Team for providing this snapshot. Their support has significantly reduced our setup time. Check them out on Twitter.

Step 15: Check The System Logs

To monitor the real-time logs of your service, you can use the journalctl command. This tool is part of the systemd suite and provides a powerful interface for querying and displaying logs from systemd and the services it manages, which is useful for troubleshooting and ensuring that your node is operating as expected:

sudo journalctl -u evmosd.service -f --no-hostname -o cat

Step 16: Creating a Wallet on Your Node

To create a new wallet on your node, you will need to use the following command. Replace YOUR_WALLET_NAME with your chosen wallet name in the command below. Decide on a name for your new wallet. For this example, I suggest using ā€œwalletā€ as the name to keep things straightforward:

evmosd keys add YOUR_WALLET_NAME

This command generates a new wallet including a public/private key pair and gives you access to the associated address on the blockchain network.

After you define a keyring passphrase, make sure to securely store the output, especially your mnemonic phrase, as it is essential for recovering your wallet if needed:

To extract and convert your wallet address to the Ethereum hex format, you can use a combination of evmosd commands and shell utilities. If your wallet name is "wallet", hereā€™s how you should format your command:

echo "0x$(evmosd debug addr $(evmosd keys show wallet -a) | grep hex | awk '{print $3}')"

To export your walletā€™s Ethereum-compatible private key from the node, youā€™ll need to use the unsafe-export-eth-key command. This command extracts the Ethereum private key from your Evmos wallet in an unencrypted format. Make sure you handle and store any output securely:

evmosd keys unsafe-export-eth-key wallet

Step 17: Request Testnet Token

To obtain testnet tokens, access the Faucet Page. Now, input your wallet address in the Ethereum hex format that you prepared earlier and complete the captcha. Next, click on the ā€œRequest A0GI Tokenā€ button to initiate the token transfer.

Once the transaction is processed, you should see a ā€œTransaction Successfulā€ message indicating that the tokens have been transferred to your wallet:

Step 18: Create Your Validator

Check the Sync Status: To verify if your node has completed syncing with the blockchain, use this command:

evmosd status | jq

When catching_up is false, your node is fully synced and ready for the next steps. This indicates that your node is up-to-date with the latest blockchain state and can participate in the network. The output will look like this:

Before you proceed with creating your validator, make sure that you have received the testnet tokens in your account. You can check your walletā€™s balance by using the following command:

evmosd q bank balances $(evmosd keys show wallet -a)

Expected output:

Now youā€™re set to run the create-validator command. Make sure to replace YOUR_MONIKER with your nodeā€™s name. If you have a website, replace YOUR_WEBSITE with its URL; if not, you can leave it empty. Then, replace YOUR_DETAILS with information about yourself as a node operator:

evmosd tx staking create-validator \
--amount=10000000000000000aevmos \
--pubkey=$(evmosd tendermint show-validator) \
--moniker=YOUR_MONIKER \
--chain-id=zgtendermint_9000-1 \
--commission-rate=0.05 \
--commission-max-rate=0.10 \
--commission-max-change-rate=0.01 \
--min-self-delegation=1 \
--from=wallet \
--website="YOUR_WEBSITE" \
--details="YOUR_DETAILS" \
--gas=500000 \
--gas-prices=99999aevmos \
-y

Expected output:

To delegate tokens to your node, use the command provided below. As of this writing, you must delegate a minimum of 1 A0GI to rank within the top 500. Your ranking is determined by the amount of aevmos you delegate. Hereā€™s how the conversion works:

  • 10,000,000,000,000,000 aevmos = 0.1 0GI
  • 100,000,000,000,000,000 aevmos = 1 A0GI
evmosd tx staking delegate $(evmosd keys show wallet --bech val -a) 10000000000000000aevmos --from wallet --gas=500000 --gas-prices=99999aevmos -y

To check your validator status you can run this command, which will also display your operator address:

evmosd q staking validator $(evmosd keys show wallet --bech val -a)

Next, navigate to the āš”ā”ƒnode-status channel on the 0G Discord server and type !val followed by your operator address. For example:

!val evmosvaloper18d0wu8ks4ftwuadf1tr9vakxs4karr9vhqugqy

You should see an output similar to the example below. Please be aware that as of this writing, you need to delegate a minimum of 1 aevmos for your status to change to ā€œactiveā€:

Step 19: Import Your Wallet to Metamask and Upload a file

Next, import your wallet into Metamask by using the private key you exported earlier in Step 16. For detailed guidance on importing an account into Metamask, you can read the instructions here. Then, visit the 0G scan and connect your wallet. Ensure you add and switch to the 0G Chain Testnet.

For the following step, click on the ā€œAdd or drop files hereā€ button, choose any image(s) youā€™d like to upload, and then click the ā€œUploadā€ button. Confirm the transaction to proceed.

If the transaction is successful, your storage submissions will appear in the list below:

Step 20: Join 0G Discord Server and Get Roles

In the last step, join the 0G Discord server and obtain the @Node operators, @Developer, and @Testnet Validator roles. You can do this by going to the roles channel and clicking on the corresponding emojis to claim these roles:

As always, I recommend staying informed about the project by following their updates on Twitter and joining their Discord community. This way, you can keep up with all the latest news and information. For troubleshooting, consult the official documentation first, and if needed, seek assistance on the official Discord server or feel free to reach out to me directly on our Discord community.

Hey everyone, Iā€™m excited to share that Iā€™ve partnered with Dotcom Canvas, a standout German brand known for its exquisite crypto-themed wall art. Their acrylic glass pieces are particularly impressive.

Discover their unique collection via my affiliate link. For a special treat, use the code CRYPTOTRIBE at checkout to get a 15% discount. To see these art pieces in their full glory, take a peek at this promotional video. Itā€™s a great way to visualize how they could elevate your space.

Letā€™s enjoy some awesome crypto art together!

Disclosure: By using my affiliate link for purchases, I receive a commission.

About me

Hi! Iā€™m ilaNihas, a big football fan (or soccer, if you prefer). After 13 years in IT, I paused my career to explore crypto, blockchain, and Web3. Iā€™m fascinated by the potential and constantly searching for interesting projects, airdrops, and new nodes to explore. Join me as I combine my passions for sports, writing, and tech. Letā€™s dive into the world of crypto and blockchain together!

Thanks for reading! Please share your feedback in a comment and follow me on my socials if you enjoyed the article. Iā€™ve also set up a Discord community where we can get together and have discussions about interesting crypto-related topics. Youā€™re welcome to join us and be part of the conversation ā†’ https://discord.gg/zN4dH35JJZ

Disclaimer

Please note that the content provided on this blog is intended solely for educational, informational, and entertainment purposes and should not be considered as financial advice. In summary, always do your own research, evaluate the information critically, and seek professional advice when necessary. Stay informed, exercise caution, and make well-informed decisions based on your own unique circumstances.

--

--

ilaNihas šŸŒ

Crypto reptile | Join us on this ride through the cryptoverse, as we explore the strangest corners of the blockchain -> https://discord.gg/zN4dH35JJZ