How To Setup your Validator Node (Matic Staking Testnet) Option“1”

charingane
4 min readJan 13, 2020

--

— Method 1 —

Hello Everyone, In this post, I am going to show you how to start with Counter Stake and setting up your validator node in Ubuntu(18.04) step by step.
So follow those steps and don’t hesitate to ask questions.

Introduction:

Matic Network is a sidechain based scaling solution for public blockchains. It is based on an adapted implementation of Plasma framework. Matic provides scalability while ensuring a superior user experience in a secure and decentralized manner.

To deploy contracts on the Matic Network, you can read our tutorial on How to deploy contracts on Matic Testnet

The latest developer and end-user resources will be updated here on a continuous basis. The Getting Started section is a good way to start discovering Matic Network and explore how DApps can integrate with Matic for scalable blockchain transactions.

The matic.js tutorial is a step-by-step tutorial that takes you through the entire deposit/transfer/withdraw flow for tokens from the Ethereum testnet to Matic testnet and vice versa.

Getting Started:

To participate in the public testnet event, you need to first set up your Full Node, You may set up your node using any one of the following options:
Option 1: Linux Package Installation (Recommended; lightweight, native)
Option 2: Running with Binaries (Relatively complex to setup, but offers advanced customization)
Option 3:
Running with Docker (Easy to set up, but a bit resource intensive)
And in this tutorial, we will use Option 1 so let’s get started.

Option 1:

Step 1: Install rabbit-mq :

We need Rabbit-MQ because Communication in RabbitMQ can be either synchronous or asynchronous as needed. Publishers send messages to exchanges, and consumers retrieve messages from queues. Decoupling producers from queues via exchanges ensures that producers aren’t burdened with hardcoded routing decisions.
So let start installation:

// update your system first
sudo apt-get update
// command to install RabbitMQ
sudo apt-get install rabbitmq-server
// start RabbitMQ server
sudo service rabbitmq-server start

Step 2: Download node setup package:

wget https://matic-public.s3.amazonaws.com/matic_node_1.0.0_amd64_ubuntu.deb

Step 3: Install Matic node services:

sudo dpkg -i matic_node_1.0.0_amd64_ubuntu.deb

Step 4: Configure Heimdall:

// Add heimdalld alias
$ echo alias heimdalld='"sudo heimdalld --home /etc/heimdall"' >> ~/.bashrc
$ source ~/.bashrc
// Initiate heimdalld node
heimdalld init
// Get Heimdall genesis config

Get Heimdall genesis config :

git clone https://github.com/maticnetwork/public-testnets
cd public-testnets/<testnet version>

// Example: $ cd public-testnets/CS-1001
echo "export CONFIGPATH=$PWD" >> ~/.bashrc
source ~/.bashrc
$ sudo cp $CONFIGPATH/heimdall-genesis.json /etc/heimdall/config/genesis.json
$ sudo cp $CONFIGPATH/heimdall-config.toml /etc/heimdall/config/heimdall-config.toml

Add your API key in the file /etc/heimdall/config/heimdall-config.toml under the key "eth_RPC_URL". If you don’t have one just create an account in https://infura.io/ and create your project and get API.

Step 5: Add Peers:

Peers are the other nodes you want to sync to in order to maintain your full node. You can add peers separated by commas at /etc/heimdall/config/config.toml under persistent_peers with the format NodeID@IP:PORT or NodeID@DOMAIN:PORT.

Open the config.toml file and copy-paste the peer address from public-testnets/<testnet version>/heimdall-seeds.txt

sudo nano /etc/heimdall/config/config.toml
paste there the heimdall-seeds

Run Heimdall:

sudo service heimdalld start
// Start Heimdall rest-server
sudo service heimdalld-rest-server start

// Start Heimdall bridge-server
sudo service heimdalld-bridge start

If everything’s well, then your logs should look something like this:

Step 7: Configure and run Bor:

Initialize genesis block for Bor:

cd /etc/bor/
sudo bor --datadir dataDir init genesis.json
sudo cp $CONFIGPATH/static-nodes.json /etc/bor/dataDir/bor/static-nodes.json
sudo service bor start

If everything’s well, then your logs should look something like this:

tail -f /var/log/matic-logs/heimdalld.log

If your Heimdall and Bor logs are fine, that your node setup is complete. Congratulations on reaching so far!

Query data:

To see examples on how to query your full node and get network status, please refer here: https://api.matic.network/staking/cs1001/swagger-ui/

That’s all for Option1, Please don’t hesitate to ask if you have any question.

For more Information:
Documentation : https://docs.matic.network/
Telegram : https://t.me/maticnetwork
Blog : https://blog.matic.network/

--

--