Setup a Validator Node

In a blockchain network, validator nodes are responsible for authenticating and validating transactions occurring on the network. These nodes ensure the security and integrity of the network by executing intricate mathematical calculations to verify that transactions comply with the network's rules. Upon successful validation, transactions are appended to the blockchain ledger, making them visible to all participants.

Validator nodes play a crucial role in maintaining the security and integrity of a blockchain. By confirming the legitimacy of transactions and thwarting fraudulent activities, they help prevent attacks or breaches that could compromise the network. In certain blockchain networks, validator nodes may also receive cryptocurrency or other incentives as rewards for their efforts.

How do validator nodes work?

Validator nodes function by participating in a consensus protocol, which is a process that allows the network to reach an agreement on the validity of transactions. There are several types of consensus protocols, such as proof-of-work (PoW), proof-of-stake (PoS), delegated proof-of-stake (dPoS), proof-of-authority (PoA), and more...

VANAR is poised to employ a hybrid consensus mechanism, primarily relying on Proof of Authority (PoA), complemented by a Proof of Reputation (PoR) mechanism to enhance network security. Validator nodes receive transactions from clients, verify their authenticity, and perform calculations to determine whether the transactions comply with the network's rules. If the transactions are valid, they are added to the blockchain. If they are not, they are discarded.

The role of a validator node is essential to maintaining the integrity of a blockchain network. By ensuring the authenticity of transactions and preventing fraudulent activities, validator nodes help to safeguard the network and its participants.

Green Vanar

Vanar is very mindful about running all nodes and infra on carbon-free and green data centers as per Google Cloud Platform guidelines. A Vanar Validator Node with a less than 90% score won't be accepted. We encourage node validators to run in a region with high CFE% (>90). To get more information you can read more about Green Vanar chain vision here.

Pre-requisites to run a validator node

  • Software: A Linux-based operating system Ubuntu 22.04 with a compatible architecture ( x86_64).

  • Network connection: A stable and high-speed 10 Gbps internet connection.

  • Minimum Hardware Requirements: A reliable server with a minimum of 8 CPU cores, 32 GB RAM, and 500 GB storage.

  • Recommended Hardware Requirements: A reliable server with a minimum of 16 CPU cores, 64 GB RAM, and 1 TB storage.

  • Preferred Region (low Carbon Data Centers): -

    • US (Lowa)

    • Europe: London, Finland

Setting up a new node: -

Step 1: Choose the blockchain network

  1. The blockchain network you are participating in is Vanarchain.

  2. Ensure you understand the network's architecture, consensus algorithm, and validators' roles.

  3. Familiarize yourself with the network's documentation, technical specifications, and community resources.

Step 2: Set up the environment

  1. Install a Linux-based operating system Ubuntu 22.04 with a compatible architecture (x86_64).

  2. Configure the network settings, DNS, and firewall rules to allow port 30311 tcp/udp incoming connections.

Step 3: Install dependencies and source code

  1. Install the required dependencies, such as:

  • git (for cloning the blockchain's repository)

  • make (for building the blockchain's binary)

  • gcc (for compiling the blockchain's code)

  1. Clone the blockchain's repository using git clone:

git clone https://github.com/VanarChain/vanarchain-blockchain.git

This is the URL of the GitHub repository. It points to a specific directory within the repository.

  1. Change into the cloned repository directory:

cd vanarchain-blockchain

  • cd: This is a command that changes the current directory to a new location.

  • vanarchain-blockchain: This is the name of the repository, which is also the directory name.

  1. “git checkout v1.1.0”: Latest tag May 2024.

  2. Run the make command to build the blockchain's binary:

make all

  1. Copies the geth file from the build directory to the parent directory. Copies the bootnode file from the build directory to the parent directory. Changes the current directory to the parent directory.

cp ./build/bin/geth /usr/bin/geth

  • cp ./build/bin/geth /usr/bin/geth: This is a command that copies a file from one location to another. It is executed as follows:

    • cp: This is the command that stands for "copy".

    • ./build/bin/geth: This is the source file to be copied. The ./ before build indicates that the directory is relative to the current directory.

    • /usr/bin/geth: This is the destination directory and filename where the file will be copied to. /usr/bin is a standard directory on Unix-like systems where executable programs are typically stored. geth is the name of the file to which the geth file will be copied.

So, this command copies the geth file from the build directory to the parent directory.

Step 4: Join the network

  1. Connect to the network by establishing connections with other nodes (peers) and broadcasting your node's presence.

  2. Validate transactions and blocks as a validator, following the network's consensus algorithm.

Account creation commands

To create a new account on the Vanar network using the Geth command-line tool, follow these steps:

Step 1: Create a new directory for your node

Create a new directory to store the blockchain data and other files:

mkdir /node

Step 2: Creating a new account

Open a terminal or command prompt and run the following command:

/usr/bin/geth --datadir /node/ account new

This is a command that creates a new Vanar account using the Geth (Go Ethereum) command-line tool. Here's a breakdown of the command:

  • /usr/bin/geth: This is the command to run the Go-Ethereum (Geth) client, which we use for Vanar node implementation.

  • --datadir /node/: This is an option for Geth that specifies the directory where the node's data files will be stored. In this case, the value is /node/.

  • account new: This option tells Geth to create a new Vanar account. The account option is followed by the new keyword, which indicates that a new account should be created.

When you run this command, Geth will create a new Vanar account and store the account's private key and other relevant information in the node/ directory. The account will be created with a new address and a balance of 0 Vanar. The same address shall be copied as the coinbase address in Geth Commands. Here's an example of what the output might look like: -.

I0900 22:30:45.551125 account/new.go:55] New account created with address0x72d5a5f4a7a5f4a5a5a5a5a5a5a5a5a5a5a5a5a5a5a

Step 3: Storing the address (optional)

You can store the address (referred to as coinbase address) in a text file to be used later. It is an optional thing to be done.

echo 'node1: <enter public address>' >> accounts.txt

This is a command that appends a line to a file using the echo command and redirects the output to a file. Here's a breakdown of the command:

  • echo: This is a built-in command that prints its arguments to the console.

  • 'node1: <enter public address>': This is the string that will be printed to the console and appended to the file. The <enter public address> part is a prompt for the user to input the public address.

  • >> accounts.txt: This is the redirection operator that appends the output of the echo command to the file accounts.txt. The >> symbol means "append to the end of the file". If the file doesn't exist, it will be created. If the file does exist, the new line will be appended to the end of the file.

This command is often used in scripting and automation tasks where you need to store public addresses or other data in a file. In this case, we are using it to store the public addresses of nodes in a file named accounts.txt.

Step 4: Storing the password

echo 'your password' > /node/password.txt

This is a command that writes a string to a file using the echo command and redirects the output to a file. Here's a breakdown of the command: -

  • echo: This is a built-in command that prints its arguments to the console.

  • 'your password': This is the string that will be printed to the console and written to the file. The string is a placeholder for the actual password.

  • > node/password.txt: This is the redirection operator that writes the output of the echo command to the file node/password.txt. The > symbol means "write to the file". If the file doesn't exist, it will be created. If the file does exist, the new content will overwrite the existing content.

When you run this command, the echo command will print the string 'your password' to the console and write it to the file node/password.txt. The file will contain the string of your password in plain text.

Security Warning: It's not recommended to store passwords in plain text files, as this can be a security risk. It's better to store passwords securely using a password manager or a secure storage mechanism.

Step 5: Use your new account

You can now use your new Vanar account to send and receive Vanry and other Vanar-based tokens. To do so, you'll need to configure your Geth node to connect to the Vanar network and participate in the consensus mechanism.

Remember to keep your private key secure and never share it with anyone. Losing access to your private key can result in the theft of your Vanar funds.

Running a new node

To run a node on the Vanar network using the Geth command-line tool write the following code.

/usr/bin/geth --vanar --datadir <node_dir> --syncmode <syncmode> --port <port> --txpool.rejournal <rejournal_interval> --txpool.globalslots <globalslots> --unlock <coinbase_address> --password <password_file> --mine --miner.etherbase <coinbase_address>

  • /usr/bin/geth: This part of the command specifies the location of the Geth binary (the executable file) on your system.

  • --vanar: This flag enables the experimental "Vanar" feature in Geth.

  • --datadir <node_dir>: The --datadir flag specifies the directory where Geth will store its data, which is typically in a folder called "node_dir".

  • --syncmode <syncmode>: The --syncmode flag specifies the type of syncing mode to be used by Geth. The possible values are:

    • "fast": Fast sync mode, which downloads block headers and state root hashes, but not state data, allowing for a faster initial sync.

    • "full": Full sync mode, which downloads all block data, including transactions and receipts, as well as state data.

    • "light": Light sync mode, which uses a server to retrieve block headers, transactions, and receipts, but not state data.

  • --port <port>: The --port flag specifies the port number on which Geth will listen for incoming connections.

  • --txpool.rejournal <rejournal_interval>: The --txpool.rejournal flag sets the interval (in seconds) at which the transaction pool is persisted to disk.

  • --txpool.globalslots <globalslots>: The --txpool.globalslots flag specifies the size of the global transaction pool.

  • --unlock <coinbase_address>: The --unlock flag unlocks the specified coinbase account, allowing it to be used for mining.

  • --password <password_file>: The --password flag specifies the location of the password file used to unlock the coinbase account.

  • --mine: The --mine flag instructs Geth to start mining blocks.

  • --miner.etherbase <coinbase_address>: The --miner.etherbase flag specifies the coinbase account to use for mining rewards.

Attaching Geth to running node

/usr/bin/geth attach /node/geth.ipc

This is a command that attaches to a running Geth node using the geth command-line tool. Here's a breakdown of the command:

  • /usr/bin/geth: This is the command-line tool for interacting with the Vanar node.

  • attach: This option tells the geth command to attach to an existing node rather than starting a new node.

  • /node/geth.ipc: This is the Unix domain socket file that connects to the existing node. The geth.ipc file is used to communicate with the node.

Verify the node

Verify that the node is running and syncing with the Vanar network. To become a validator please reach out to the Vanar team and share your account public address.

Last updated