NEAR Protocol is a blockchain infrastructure used for building secure & scalable decentralized applications (dApps). It offers developers a user-friendly environment for developing and deploying dApps. Running a node on the NEAR network is crucial for maintaining the network’s decentralization & security. Let’s learn How to Run NEAR node?
Table of Contents
Understanding Nodes in NEAR Protocol
What is a Node?
In the context of NEAR Protocol, a node is a computer that participates in the network by validating and verifying transactions. Nodes store a copy of the blockchain and communicate with other nodes to maintain network consensus.
Types of Nodes in NEAR Protocol
NEAR Protocol has two main types of nodes: validator nodes and observer nodes. Validator nodes validate transactions and participate in consensus, while observer nodes observe network activity and provide data to other nodes.
Roles & Responsibilities
Validator nodes are crucial for securing the network by validating transactions and producing blocks. Observer nodes contribute to the network by providing data and helping to distribute information efficiently.
How to Run NEAR Node?
1. Preparing Your System
Hardware Requirements
Running a NEAR node requires a system with sufficient computing power, including a modern multi-core CPU, RAM (typically 8GB or more), and significant disk space (at least 100GB).
Software Requirements
Ensure your system meets the software requirements specified by NEAR Protocol, including the appropriate operating system and software dependencies.
System Security Considerations
Prioritize system security by implementing firewall configurations, regular software updates, and securing access to your node.
2. Installing NEAR Software
Downloading NEAR Software
Obtain the NEAR software from the official NEAR Protocol website or repository.
Installation Instructions for Various Operating Systems
Follow the step-by-step instructions for your operating system, whether it’s Windows, macOS, or Linux.
3. Installation Commands for Various Operating Systems
For Linux
wget https://github.com/nearprotocol/nearcore/releases/download/0.0.1/nearcore_0.0.1_linux_amd64.tar.gz
tar -xvzf nearcore_0.0.1_linux_amd64.tar.gz
cd nearcore_0.0.1_linux_amd64
./near –version
For macOS
curl -O https://github.com/nearprotocol/nearcore/releases/download/0.0.1/nearcore_0.0.1_macos_amd64.tar.gz
tar -xvzf nearcore_0.0.1_macos_amd64.tar.gz
cd nearcore_0.0.1_macos_amd64
./near –version
For Windows
curl -o nearcore_0.0.1_windows_amd64.zip -L https://github.com/nearprotocol/nearcore/releases/download/0.0.1/nearcore_0.0.1_windows_amd64.zip
tar -xvzf nearcore_0.0.1_windows_amd64.zip
cd nearcore_0.0.1_windows_amd64
near.exe –version
Verifying Installation
After installation, verify that the NEAR software is installed correctly and functioning as expected by checking system logs and running diagnostic commands.
4. Joining the NEAR Network
Configuring Node Settings
Configure your node to join the NEAR network by specifying parameters such as network connectivity settings and synchronization options.
Connecting to Other Nodes
Establish connections with other nodes in the NEAR network to exchange data and participate in network consensus.
Syncing with the Blockchain
Synchronize your node with the NEAR blockchain to ensure it has the most up-to-date copy of the blockchain ledger.
5. Configuring Node Settings
Validator Node Configuration
Configure settings related to staking, consensus participation, and block production when running a validator node. Follow these commands:
{
“network”: {
“bind”: “0.0.0.0:3030”,
“seeds”: [“seed1.example.com:24567”, “seed2.example.com:24567”]
},
“validator”: {
“account-id”: “validator_account_id”,
“private-key”: “validator_private_key”
},
“staking”: {
“pool”: “pool_account_id”,
“amount”: “100000000000000000000000”
}
}
Observer Node Configuration
For observer nodes, focus on configuring settings that optimize data retrieval and distribution, such as network bandwidth allocation and data caching strategies. Follow these commands:
{
“network”: {
“bind”: “0.0.0.0:3030”,
“seeds”: [“seed1.example.com:24567”, “seed2.example.com:24567”]
},
“observer”: true
}
Setting Up Staking (for Validators)
Validators can stake NEAR tokens to participate in consensus and earn rewards for securing the network. Set up staking parameters according to your preferences and network requirements.
6. Securing Your Node
Best Practices for Node Security
Implement best practices for securing your node, including firewall configurations, regular software updates, and encryption of sensitive data.
Firewall Configurations
Configure firewall rules to restrict unauthorized access to your node and protect it from external threats.
Regular Updates & Maintenance
Stay vigilant by regularly updating your node software and performing routine maintenance tasks to address security vulnerabilities and ensure optimal performance.
7. Staking Commands (for Validators)
Stake NEAR Tokens
php
near stake <pool_account_id> <amount>
Unstake NEAR Tokens
php
near unstake <pool_account_id> <amount>
8. Firewall Configuration (Linux)
Open Port 3030 for NEAR Protocol
sudo ufw allow 3030/tcp
9. Monitoring Node Performance
Tools for Monitoring Node Performance
Utilize monitoring tools provided by NEAR Protocol or third-party solutions to track key performance metrics such as CPU usage, memory usage, and network bandwidth.
Network Health Monitoring
Monitor the overall health of the NEAR network by analyzing network latency, block propagation times, and other indicators of network performance.
Check Network Latency
r
ping -c 5 example.com
10. Monitoring Node Performance
Check CPU Usage
css
top
Check Memory Usage
c
free -m
Check Network Bandwidth
iftop
11. Troubleshooting Common Issues
Be prepared to troubleshoot common issues with your node, such as syncing problems, connectivity issues, or hardware failures. They may or may not be there.
Syncing Problems
bash
near sync –force
Connectivity Issues
near logs
Hardware Failures
go
dmesg | grep error
12. Contributing to the NEAR Community
Engaging with the NEAR Community
Participate in community forums, social media channels, and developer meetups to engage with other NEAR enthusiasts and contribute to the ecosystem’s growth.
Participating in Discussions
Join discussions on protocol upgrades, governance proposals, and dApp development to share your insights and learn from others.
Contributing to Protocol Development
Contribute to the development of the NEAR Protocol by submitting code contributions, bug reports, or improvement proposals to the NEAR GitHub repository.
Conclusion
Running a node on the NEAR Protocol network is rewarding for the ecosystem’s security, scalability, and decentralization. Following the steps outlined in this article, you can set up and maintain a node that plays a crucial role in supporting the NEAR network and fostering its growth. As the NEAR community continues to evolve & innovate, your participation as a node operator will help shape the future of decentralized applications and Blockchain technology.
FAQ,s
Q.1 How do I stake NEAR tokens as a validator?
To stake NEAR tokens as a validator, use the command near stake <pool_account_id> <amount>. Replace <pool_account_id> with the ID of the staking pool and <amount> with the number of tokens you want to stake.
Q.2 What should I do if my node encounters syncing problems?
If your node encounters syncing problems, use the command near sync –force to force a resynchronization with the NEAR blockchain. This command can help resolve issues related to out-of-sync nodes.
Q.3 How can I check the CPU and memory usage of my node?
To check the CPU & memory usage of your node, use the top of the command for CPU usage and free -m for memory usage. These commands provide real-time information about system resource utilization.
Q.4 What firewall configurations are necessary for running a NEAR node on Linux?
To open port 3030 for NEAR Protocol on Linux, use the command sudo ufw allow 3030/tcp. This firewall configuration allows incoming TCP traffic on port 3030, which is used by NEAR nodes for communication.
Q.5 How do I monitor network latency and block propagation time?
To monitor network latency, use the command ping -c 5 example.com, replacing example.com with a domain or IP address. To check block propagation time, use the command near current-block to retrieve information about the current block.
Q.6 What should I do if I encounter connectivity issues with my node?
If you encounter connectivity issues with your node, check the logs using the command near logs. The logs provide detailed information about network connections, errors, and other relevant events that can help diagnose and troubleshoot connectivity issues.