Share Dialog
Share Dialog
<100 subscribers
<100 subscribers


Published on: 2022–07–27
Updated on: 2022–07–27
Submitted by: Crjobo I will guide you through the challenges of Stake War III. We will start by creating your Shardnet wallet & deploy the NEAR CLI. It will give you the opportunity to understand how staking on NEAR works.
No submission si required for this challenge; it will be evaluated together with the next one (002).
Wallet: https://wallet.shardnet.near.org/ Explorer: https://explorer.shardnet.near.org/
First step is to create a wallet. Head here and follow the steps. Do NOT FORGET to note down your secret phrase on paper. https://wallet.shardnet.near.org/

Head up to hetzner.com and buy a Server to deploy your node and validator node. I recommend: https://www.hetzner.com/dedicated-rootserver/ax41-nvme/configurator#/ The setup will take up to 15 minutes depending on how you pay and how fast your transaction will be. It will cost you ca 40e a month
When done, go to you favorite Command Line Interface (CLI) and connect to your server through ssh. The form should be sudo ssh root@YOUR-IP Then enter the password you have received from Hetzner.
NEAR-CLI is a command-line interface that communicates with the NEAR blockchain via remote procedure calls (RPC):
Setup and Installation NEAR CLI
View Validator Stats
Note: For security reasons, it is recommended that NEAR-CLI be installed on a different computer than your validator node and that no full access keys be kept on your validator node. Also if you configure both on the same server you will run into an issue later in the guide as you node and your validator node will want to run in // and will conflict. You will have then to kill the node before launching the validator node. First, let's make sure the linux machine is up-to-date.
sudo apt update && sudo apt upgrade -y
Then, we will start with installing Node.js and npm:
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install build-essential nodejs
PATH="$PATH"
Check Node.js and npm version:
node -v
v18.x.x
npm -v
8.x.x
Here's the Github Repository for NEAR CLI.: https://github.com/near/near-cli. To install NEAR-CLI, unless you are logged in as root, which is not recommended you will need to use sudo to install NEAR-CLI so that the near binary is saved to /usr/local/bin
sudo npm install -g near-cli
Now that NEAR-CLI is installed, let's test out the CLI and use the following commands to interact with the blockchain as well as to view validator stats. There are three reports used to monitor validator status:
The environment will need to be set each time a new shell is launched to select the correct network. Networks:
GuildNet
TestNet
MainNet
Shardnet (this is the network we will use for Stake Wars) Command:
export NEAR_ENV=shardnet
You can also run this command to set the Near testnet Environment persistent:
echo 'export NEAR_ENV=shardnet' >> ~/.bashrc
A proposal by a validator indicates they would like to enter the validator set, in order for a proposal to be accepted it must meet the minimum seat price. Command:
This shows a list of active validators in the current epoch, the number of blocks produced, number of blocks expected, and online rate. Used to monitor if a validator is having issues. Command:
near validators current
This shows validators whose proposal was accepted one epoch ago, and that will enter the validator set in the next epoch. Command:
near validators next
- -
Congrats you have managed the first step in you adventure. Let's go for step 2.
Published on: 2022-07-26
Updated on: 2022-07-15
Submitted by: Crjobo
Reward: 30 Unlocked NEAR Points (UNP) This challenge is focused on deploying a node (nearcore), downloading a snapshot, syncing it to the actual state of the network, then activating the node as a validator.
Useful links Wallet: https://wallet.shardnet.near.org/
Explorer: https://explorer.shardnet.near.org/
Hardware Chunk-Only Producer Specifications CPU 4-Core CPU with AVX support RAM 8GB DDR4 Storage 500GB SSD
Prerequisites: Before you start, you may want to confirm that your machine has the right CPU features.
lscpu | grep -P '(?=.*avx )(?=.*sse4.2 )(?=.*cx16 )(?=.*popcnt )' > /dev/null && echo "Supported" || echo "Not supported"
Supported
Install developer tools:
sudo apt install -y git binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev cmake gcc g++ python docker.io protobuf-compiler libssl-dev pkg-config clang llvm cargo
Install Python pip:
sudo apt install python3-pip
Set the configuration:
USER_BASE_BIN=$(python3 -m site --user-base)/bin
export PATH="$USER_BASE_BIN:$PATH"
Install Building env
sudo apt install clang build-essential make
Install Rust & Cargo
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Press 1 and press enter.
Source the environment
source $HOME/.cargo/env
First, clone the nearcore repository.
git clone https://github.com/near/nearcore
cd nearcore
git fetch
Checkout to the commit needed. Please refer to the commit defined in this file.
git checkout Compile nearcore binary In the nearcore folder run the following commands: cargo build -p neard --release --features shardnet The binary path is target/release/neard. If you are seeing issues, it is possible that cargo command is not found. Compiling nearcore binary may take a little while. Initialize working directory In order to work properly, the NEAR node requires a working directory and a couple of configuration files. Generate the initial required working directory by running: ./target/release/neard --home ~/.near init --chain-id shardnet --download-genesis img This command will create the directory structure and will generate config.json, node_key.json, and genesis.json on the network you have passed. config.json - Configuration parameters which are responsive for how the node will work. The config.json contains needed information for a node to run on the network, how to communicate with peers, and how to reach consensus. Although some options are configurable. In general validators have opted to use the default config.json provided. genesis.json - A file with all the data the network started with at genesis. This contains initial accounts, contracts, access keys, and other records which represents the initial state of the blockchain. The genesis.json file is a snapshot of the network state at a point in time. In contacts accounts, balances, active validators, and other information about the network. node_key.json - A file which contains a public and private key for the node. Also includes an optional account_id parameter which is required to run a validator node (not covered in this doc). data/ - A folder in which a NEAR node will write it's state. Replace the config.json From the generated config.json, there two parameters to modify: boot_nodes: If you had not specify the boot nodes to use during init in Step 3, the generated config.json shows an empty array, so we will need to replace it with a full one specifying the boot nodes. tracked_shards: In the generated config.json, this field is an empty. You will have to replace it to "tracked_shards": [0] rm ~/.near/config.json wget -O ~/.near/config.json https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/shardnet/config.json Get latest snapshot IMPORTANT: NOT REQUIRED TO GET SNAPSHOT AFTER HARDFORK ON SHARDNET DURING 2022-07-18 Install AWS Cli sudo apt-get install awscli -y Download snapshot (genesis.json) // IMPORTANT: NOT REQUIRED TO GET SNAPSHOT AFTER HARDFORK ON SHARDNET DURING 2022-07-18 cd ~/.near wget https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/shardnet/genesis.json
Published on: 2022–07–27
Updated on: 2022–07–27
Submitted by: Crjobo I will guide you through the challenges of Stake War III. We will start by creating your Shardnet wallet & deploy the NEAR CLI. It will give you the opportunity to understand how staking on NEAR works.
No submission si required for this challenge; it will be evaluated together with the next one (002).
Wallet: https://wallet.shardnet.near.org/ Explorer: https://explorer.shardnet.near.org/
First step is to create a wallet. Head here and follow the steps. Do NOT FORGET to note down your secret phrase on paper. https://wallet.shardnet.near.org/

Head up to hetzner.com and buy a Server to deploy your node and validator node. I recommend: https://www.hetzner.com/dedicated-rootserver/ax41-nvme/configurator#/ The setup will take up to 15 minutes depending on how you pay and how fast your transaction will be. It will cost you ca 40e a month
When done, go to you favorite Command Line Interface (CLI) and connect to your server through ssh. The form should be sudo ssh root@YOUR-IP Then enter the password you have received from Hetzner.
NEAR-CLI is a command-line interface that communicates with the NEAR blockchain via remote procedure calls (RPC):
Setup and Installation NEAR CLI
View Validator Stats
Note: For security reasons, it is recommended that NEAR-CLI be installed on a different computer than your validator node and that no full access keys be kept on your validator node. Also if you configure both on the same server you will run into an issue later in the guide as you node and your validator node will want to run in // and will conflict. You will have then to kill the node before launching the validator node. First, let's make sure the linux machine is up-to-date.
sudo apt update && sudo apt upgrade -y
Then, we will start with installing Node.js and npm:
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install build-essential nodejs
PATH="$PATH"
Check Node.js and npm version:
node -v
v18.x.x
npm -v
8.x.x
Here's the Github Repository for NEAR CLI.: https://github.com/near/near-cli. To install NEAR-CLI, unless you are logged in as root, which is not recommended you will need to use sudo to install NEAR-CLI so that the near binary is saved to /usr/local/bin
sudo npm install -g near-cli
Now that NEAR-CLI is installed, let's test out the CLI and use the following commands to interact with the blockchain as well as to view validator stats. There are three reports used to monitor validator status:
The environment will need to be set each time a new shell is launched to select the correct network. Networks:
GuildNet
TestNet
MainNet
Shardnet (this is the network we will use for Stake Wars) Command:
export NEAR_ENV=shardnet
You can also run this command to set the Near testnet Environment persistent:
echo 'export NEAR_ENV=shardnet' >> ~/.bashrc
A proposal by a validator indicates they would like to enter the validator set, in order for a proposal to be accepted it must meet the minimum seat price. Command:
This shows a list of active validators in the current epoch, the number of blocks produced, number of blocks expected, and online rate. Used to monitor if a validator is having issues. Command:
near validators current
This shows validators whose proposal was accepted one epoch ago, and that will enter the validator set in the next epoch. Command:
near validators next
- -
Congrats you have managed the first step in you adventure. Let's go for step 2.
Published on: 2022-07-26
Updated on: 2022-07-15
Submitted by: Crjobo
Reward: 30 Unlocked NEAR Points (UNP) This challenge is focused on deploying a node (nearcore), downloading a snapshot, syncing it to the actual state of the network, then activating the node as a validator.
Useful links Wallet: https://wallet.shardnet.near.org/
Explorer: https://explorer.shardnet.near.org/
Hardware Chunk-Only Producer Specifications CPU 4-Core CPU with AVX support RAM 8GB DDR4 Storage 500GB SSD
Prerequisites: Before you start, you may want to confirm that your machine has the right CPU features.
lscpu | grep -P '(?=.*avx )(?=.*sse4.2 )(?=.*cx16 )(?=.*popcnt )' > /dev/null && echo "Supported" || echo "Not supported"
Supported
Install developer tools:
sudo apt install -y git binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev cmake gcc g++ python docker.io protobuf-compiler libssl-dev pkg-config clang llvm cargo
Install Python pip:
sudo apt install python3-pip
Set the configuration:
USER_BASE_BIN=$(python3 -m site --user-base)/bin
export PATH="$USER_BASE_BIN:$PATH"
Install Building env
sudo apt install clang build-essential make
Install Rust & Cargo
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Press 1 and press enter.
Source the environment
source $HOME/.cargo/env
First, clone the nearcore repository.
git clone https://github.com/near/nearcore
cd nearcore
git fetch
Checkout to the commit needed. Please refer to the commit defined in this file.
git checkout Compile nearcore binary In the nearcore folder run the following commands: cargo build -p neard --release --features shardnet The binary path is target/release/neard. If you are seeing issues, it is possible that cargo command is not found. Compiling nearcore binary may take a little while. Initialize working directory In order to work properly, the NEAR node requires a working directory and a couple of configuration files. Generate the initial required working directory by running: ./target/release/neard --home ~/.near init --chain-id shardnet --download-genesis img This command will create the directory structure and will generate config.json, node_key.json, and genesis.json on the network you have passed. config.json - Configuration parameters which are responsive for how the node will work. The config.json contains needed information for a node to run on the network, how to communicate with peers, and how to reach consensus. Although some options are configurable. In general validators have opted to use the default config.json provided. genesis.json - A file with all the data the network started with at genesis. This contains initial accounts, contracts, access keys, and other records which represents the initial state of the blockchain. The genesis.json file is a snapshot of the network state at a point in time. In contacts accounts, balances, active validators, and other information about the network. node_key.json - A file which contains a public and private key for the node. Also includes an optional account_id parameter which is required to run a validator node (not covered in this doc). data/ - A folder in which a NEAR node will write it's state. Replace the config.json From the generated config.json, there two parameters to modify: boot_nodes: If you had not specify the boot nodes to use during init in Step 3, the generated config.json shows an empty array, so we will need to replace it with a full one specifying the boot nodes. tracked_shards: In the generated config.json, this field is an empty. You will have to replace it to "tracked_shards": [0] rm ~/.near/config.json wget -O ~/.near/config.json https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/shardnet/config.json Get latest snapshot IMPORTANT: NOT REQUIRED TO GET SNAPSHOT AFTER HARDFORK ON SHARDNET DURING 2022-07-18 Install AWS Cli sudo apt-get install awscli -y Download snapshot (genesis.json) // IMPORTANT: NOT REQUIRED TO GET SNAPSHOT AFTER HARDFORK ON SHARDNET DURING 2022-07-18 cd ~/.near wget https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/shardnet/genesis.json
No comments yet