Running a blockchain node
The "Run Blockchain" section contains all the guides concerning the management of accounts and Klayr nodes, and is therefore especially interesting for validators and other Klayr node operators.
What is a blockchain node?
The Klayr blockchain is a decentralized network that consists of many different servers, (or nodes). A blockchain node is a server with a running blockchain client, such as Klayr Core. Nodes are usually connected to other nodes which are running an instance of the same client via P2P. Node operators are required to set up a node on a server, and then connect it to the desired network.
Depending on the node configuration, a node can have different roles in the network. In the Klayr ecosystem, a node can be any one of the following four types.
RPC nodes
If the RPC API of a node is enabled, it allows external services to send queries to the node and/or to subscribe to specific events that are happening in the network. For example, these external services could be other scripts in JS, a Python daemon, a tool in Rust, etc. Depending on the node configuration, an RPC node can accept different communication protocols such as Hypertext Transfer Protocol (HTTP), WebSocket (WS), and Inter-Process Communication (IPC).
For more information, see the following:
-
Supported communication protocols: Communicating to a Klayr node via RPC.
-
RPC endpoints: RPC API for Klayr nodes.
Validator nodes
In the Klayr PoS, a certain set of validators is selected by the network to add new blocks to the blockchain. To participate in the block generation process, a validator needs to set up a node and configure it to enable block generation. These nodes are called validator nodes.
In the Klayr Mainnet, exactly 53 validators exist in the network for each block generation round. Validator nodes are the only nodes that can propose new blocks to the blockchain. During a block generation round, every validator node has the opportunity to generate at least one block.
Validator nodes fulfill a very important role in the network, and therefore they require certain additional configurations regarding enabling block generation and higher security measures, as compared to regular nodes. Furthermore, they are equal to any non-validator node in the network and follow the same installation process.
For more information on how to become a validator and enable block generation, check out the guide How to become a validator. |
Relayer nodes
Nodes from different chains can interact with one another in the Klayr ecosystem, and this interaction is carried out via relayer nodes. Any chain such as a mainchain or a sidechain can have relayer node(s). Relayer nodes are nodes of a blockchain that are configured to relay Cross-Chain Updates (CCUs) and Cross-Chain Messages (CCMs) to another blockchain[1]. A sidechain always has to communicate with other blockchains via the mainchain.
Consider a sidechain S1 with 20 nodes, whereby one of these nodes has been configured to act as a relayer node. The job of this relayer node is to collect CCUs & CCMs from the other nodes of S1 and subsequently pass them on to the receiving mainchain. If a sidechain S1 wants to communicate with another sidechain S2, it will be required to have a relayer set up on S1, S2, and on the mainchain. The CCUs will then take the route of S1 → Mainchain → S2 and vice versa.
To become a relayer node, Klayr provides an easy-to-use plugin called the Chain Connector. The chain connector plugin allows a node to act as a relayer of CCUs and CCMs. A relayer node can be configured for both mainchain and sidechains. Once configured, a relayer node can directly connect with the RPC nodes of the receiving chains.
Klayr Service nodes
Klayr Service is a data aggregation service that connects to a particular RPC node and aggregates the blockchain data, to provide enriched API endpoints for other applications and services that rely on data from the blockchain.
Account management
- Related guides
If you are intending to generate blocks for the first time, it is highly recommended to first check out the dedicated guide: How to become a validator. Furthermore, to acquire a secure validator spot for a block generation round, a validator must be one of the top 103 validators with the most validator weight in the network. To view the currently required thresholds for entering the top 103, check the validator weights of the currently active 103 validators, for example, in one of the public Klayr network explorers:
-
Klayr Scan: https://explorer.klayr.xyz/
Node management
- Who should operate a node?
-
If you fall under one of the following categories listed below, then it is recommended to set up your own node:
-
Exchanges, Web3 app developer: and other services that rely on a stable API interface to the network.
-
Relayers: Who participate in the Klayr cross-chain communication by relaying CCUs.
-
Validators: Who would like to actively generate new blocks.
-
Users: Who do not trust external sources and want to be in full control over their own node.
-
- How to set up a Klayr Mainnet/Testnet node
-
Klayr Core is the blockchain client that maintains the Klayr Mainnet and Testnet, depending on the configuration.
To set up Klayr Core, choose a distribution and follow the respective setup guide:
-
NPM: NPM setup
-
Binary: Binary setup
-
Docker: Docker setup
-
Source code: Source code setup
-
- How to set up a Relayer node
- Related guides
-
-
Klayr Core Configuration: Klayr Core configuration
-
Process management with PM2: Process management with PM2
-