When it comes to creating nodes for just about any blockchain network, the procedure can be a bit different and difficult for newcomers who might not have historically had any experience when it comes to setting one up.
As a means of making this process as simple and as streamlined as possible, we have created a step-by-step guide that you can follow as a means of running your very own Casper node.
But before we go over all of that, it is important to understand what Casper is first. Let’s dive in.
- Casper is essentially a blockchain platform that was specifically built to provide a scaling opportunity for just about anyone who decides to use it.
- It is designed for real-world applications without the need for them to sacrifice any usability, cost, decentralization, or even security by removing barriers that prevent mainstream blockchain adoption.
- The Casper Network is a public, decentralized and energy-efficient Proof-of-Stake (Pos) blockchain network that features the CBC-Casper consensus protocol and was developed by CasperLabs in late 2018.
- When it comes to running a Casper node, you can set one up manually for yourself or utilize the blockchain-as-a-service provider NOWNodes as a means of achieving this goal.
What is Casper node?
Casper utilizes a correct-by-construction (CBC) construct, and within it, consensus-building peer nodes, which are known as validators, are able to generate and pass messages as a means of trying to reach a consensus on the blocks which are newly created. Furthermore, a block proposer is able to select a set of pending transactions and can include the hashes of the transactions within a block.
This is called a proto-block, and consensus executes, after which the block is finalized. Once the transaction has been finalized, however, the validator nodes can execute all of the transactions within the block and can then update their internal state. They can then send a finality signature, which in turn indicates that they have completed executing a specific block and have added it to a linear chain, thus updating their internal state.
Why choose Casper node?
There are numerous advantages when it comes to running a blockchain node on just about any network. Node operators can access data, including data surrounding the hash rate, difficulty, block height, wallet addresses, transaction data, balance history tickers list, or anything else that they might need either to secure the network or to develop a specific decentralized application (dApp) on top of it.
In the case of a Casper node, it is an essential part of the network that plays a key role in its security and maintenance, and as a result of this, many users might be incentivized to run their very own Casper node.
How to run Casper node?GET ACCESS TO CASPER
If you have ever wanted to set up and run your very own Casper node, here is everything that you need to do, step-by-step.
- Step 1: Get The Casper Node Launcher
Typically, a node gets run through the execution of the Casper Node Launcher. This is an application that executes the node as a child process and handles upgrades of it.
You need to install it through a Debian package, which also creates the Casper user and creates directory signatures, which sets up a systemd unit and loggint.
You can easily obtain the Debian package from https://repo.casperlabs.io, and all you have to do is run the steps.
If you want to add a repository on Ubuntu 18.04, you can use this command:
|echo “deb [arch=amd64] https://repo.casperlabs.io/releases bionic main” | sudo tee -a /etc/apt/sources.list.d/casper.list|
To add a repository on Ubuntu 20.04, use this command:
|echo “deb [arch=amd64] https://repo.casperlabs.io/releases focal main” | sudo tee -a /etc/apt/sources.list.d/casper.list|
After adding the repository, add the public gpg key and update the package manager:
|curl -O https://repo.casperlabs.io/casper-repo-pubkey.asc|
sudo apt-key add casper-repo-pubkey.asc
sudo apt update
Then, you can verify the repository was added correctly by checking the existence of the casper-client package, through running this command:
|sudo apt list casper-client|
- Step 2: Install the Casper Node Launcher
Then, install it by running these commands:
|sudo apt update|
sudo apt install -y casper-client casper-node-launcher jq
Note that the Debian installer creates the directories as well as files required for running the casper-node versions and performing upgrades over them.
A casper user and casper groups are created during the install process and are utilized as a means of running the software. There are two main folders, including /etc/casper and /var/lib/casper.
You can also install all of the protocols:
|sudo -u casper /etc/casper/node_util.py stage_protocols casper.conf|
And if you do not have keys, you can create them through the following command:
|sudo -u casper casper-client keygen /etc/casper/validator_keys|
- Step 3: Node Version Installation
With the launcher, you also have node_util.py installed, which is required for the installation of all of the node versions.
You can get a list of all of the network protocol versions by running this command:
|curl -s genesis.casperlabs.io/casper/protocol_versions|
To stage all of the current casper-node versions, you need to run the following command:
|sudo -u casper /etc/casper/node_util.py stage_protocols <NETWORK_CONFIG>|
Then you can run the following command to configure the MainNet and TestNet for Casper.
|sudo -u casper /etc/casper/pull_casper_node_version.sh 1_0_2|
Now you need to ensure that you install all of the prerequisites found here before installing the Casper Client.
You can then create and fund keys with this command:
|sudo -u casper casper-client keygen /etc/casper/validator_keys|
Now, the node requires a publicly accessible IP address. The config_from_example.sh and node_util.py will allow IP for network address translation (NAT) setup.
Here, you will need to specify the public IP address of the node.
The default values are specified in the file, and if you want to change them, you need to specify the port which will get used for status and deploys and then specify the port used for networking.
- Step 4: Get a Trusted Hash and Start the Node
In order to get a trusted hash, you will need to execute the following command:
|sudo sed -i “/trusted_hash =/c\trusted_hash = ‘$(casper-client get-block –node-address http://18.104.22.168:7777 -b 20 | jq -r .result.block.hash | tr -d ‘\n’)'” /etc/casper/1_0_0/config.toml|
Then you can start the node by running the following command:
|sudo /etc/casper/node_util.py rotate_logs|
sudo /etc/casper/node_util.py start
In order to monitor the node synchronization process, you can use this command:
The result of this command should be something along these lines:
|Last Block: 630151 (Era: 4153)|
Peer Count: 297
Uptime: 4days 6h 40m 18s 553ms
Next Upgrade: None
● casper-node-launcher.service – Casper Node Launcher
Loaded: loaded (/lib/systemd/system/casper-node-launcher.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-03-16 21:08:50 UTC; 4 days ago
Main PID: 2934 (casper-node-lau)
Tasks: 12 (limit: 4915)
├─ 2934 /usr/bin/casper-node-launcher
└─16842 /var/lib/casper/bin/1_4_5/casper-node validator /etc/casper/1_4_5/config.toml“`
If your `casper-node-launcher status` for not show active (running) with an increasing time, you are either not running or restarting.
## Monitor your node once it is up.
Get a monitoring tool in place. The community has created a few tools such as:
– Status.py: https://github.com/RapidMark/casper-tools
– Grafana: https://github.com/matsuro-hadouken/casper-tools
Hopefully, now you know everything there is to know surrounding the process of running a Casper node. Note that you can also, alternatively, connect to a pre-existing node through the utilization of the blockchain-as-a-service provider NOWNodes.
With the data you get from the node, you can ensure that the network is properly operating and can begin building dApps or anything else on top of the network.GET ACCESS TO CASPER