Just recently, Near Protocol launched the third episode of the Testnet. Don't miss your chance to become a validator of the most promising project of this season! Let's not procrastinate and get to work right away.
First of all we need to create a Near Shardnet Wallet. You can follow this link and do it.
https://wallet.shardnet.near.org/
- Please, create account
- Save your Account ID and memory phrase
- You will automatically receive bonus tokens to your wallet.
Our task is to buy a cloud server from one of the providers, which will meet the requirements of the network.
Choose one of these providers.
Then select a server with suitable parameters.
I ordered a server from Hetzner with the parameters: vCPU8, AMD/RAM16GB, Disk space 240GB for โฌ 27.25.
Let's move to the most difficult and demanding step
sudo apt update -y && sudo apt upgrade -y
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
Install Building env:
sudo apt install build-essential nodejs -y
PATH="$PATH"
Check version node.js and npm
node -v
npm -v
sudo npm install -g near-cli
Setting up the environment. The current testnet is on the shardnet network. Enter the name of the network as a variable.
export NEAR_ENV=shardnet
echo 'export NEAR_ENV=shardnet' >> ~/.bashrc
echo 'export NEAR_ENV=shardnet' >> ~/.bash_profile
Activate the Rust environment for the current shell
source $HOME/.bash_profile
Checking confirm CPU
lscpu | grep -P '(?=.*avx )(?=.*sse4.2 )(?=.*cx16 )(?=.*popcnt )' > /dev/null \
&& echo "Supported" \
|| echo "Not supported"
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
Installing python pip
sudo apt install python3-pip -y
Seting the configuration
USER_BASE_BIN=$(python3 -m site --user-base)/bin
export PATH="$USER_BASE_BIN:$PATH"
Installing Building env
sudo apt install clang build-essential make
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
Clone a repository with a node
git clone [https://github.com/near/nearcore](https://github.com/near/nearcore)
cd nearcore
git fetch
Checking a commit. You can find the current commit at https://github.com/near/stakewars-iii/blob/main/commit.md
git checkout 68bfa84ed1455f891032434d37ccad696e91e4f5
cargo build -p neard --release --features shardnet
Initialize the node and load the genesis file
./target/release/neard --home ~/.near init --chain-id shardnet --download-genesis
rm ~/.near/config.json
wget -O ~/.near/config.json [https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/shardnet/config.json](https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/shardnet/config.json)
Installing AWS Cli
sudo apt-get install awscli -y
Downloading snapshot (genesis.json)
cd ~/.near
wget [https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/shardnet/genesis.json](https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/shardnet/genesis.json)
cd ~/nearcore
./target/release/neard --home ~/.near run
Running the command
near login
- Copy the link and open it in the browser where you installed the wallet in the first task.
- Enter Account_ID and give all necessary permissions, after the page gives an error connection, your wallet will be credited.
- Go to the terminal and enter the name of the wallet (Account_ID).
- For further ease of use of the commands, create variables moniker, pool ID and account ID. Replace with your nickname.
Generating the Key file and copy
near generate-key rozoviymir1.shardnet.near.json
cp ~/.near-credentials/shardnet/rozoviymir1.shardnet.near.json ~/.near/validator_key.json
target/release/neard run
Creating systemd unit and enable/start
cat <<'EOF' | sudo tee /etc/systemd/system/neard.service
[Unit]
Description=NEARd Daemon Service
[Service]
Type=simple
User=root
#Group=near
WorkingDirectory=/root/.near
ExecStart=/root/nearcore/target/release/neard run
Restart=on-failure
RestartSec=30
KillSignal=SIGINT
TimeoutStopSec=45
KillMode=mixed
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable neard
sudo systemctl start neard
sed -i 's/private_key/secret_key/' ~/.near/validator_key.json
near call factory.shardnet.near create_staking_pool '{"staking_pool_id": "rozoviymir1", "owner_id": "rozoviymir1.shardnet.near", "stake_public_key": "ed25519:71sycAtftkaoQMs1Bpuz2TjLFARWJ1KyHB4LTvH1ZCWo", "reward_fee_fraction": {"numerator": 5, "denominator": 100}, "code_hash":"DD428g9eqLL8fWUxv8QSpVFzyHi1Qd16P8ephYCTmMSZ"}' --accountId="rozoviymir1.shardnet.near" --amount=30 --gas=300000000000000
ear call factory.shardnet.near create_staking_pool '{"staking_pool_id": "rozoviymir1", "owner_id": "rozoviymir1.shardnet.near", "stake_public_key": "ed25519:71sycAtftkaoQMs1Bpuz2TjLFARWJ1KyHB4LTvH1ZCWo", "reward_fee_fraction": {"numerator": 5, "denominator": 100}, "code_hash":"DD428g9eqLL8fWUxv8QSpVFzyHi1Qd16P8ephYCTmMSZ"}' --accountId="rozoviymir1.shardnet.near" --amount=30 --gas=300000000000000
near call furla.factory.shardnet.near deposit_and_stake --amount 10 --accountId.shardnet.near --gas=300000000000000
Please, log files
check in dir ~/.nearup/logs
with color
apt install ccze jq curl -y
journalctl -n 100 -f -u neard | ccze -A
And then
curl -s http://127.0.0.1:3030/status | jq .version
Make directory
mkdir -p ~/scripts
mkdir -p ~/logs
cat <<'EOF' | sudo tee /root/scripts/ping.sh
#!/bin/sh
export NEAR_ENV=shardnet
export LOGS=/root/logs
export POOLID=rozoviymir1
export ACCOUNTID=rozoviymir1
echo "---" >> $LOGS/all.log
date >> $LOGS/all.log
near call $POOLID.factory.shardnet.near ping '{}' --accountId $ACCOUNTID.shardnet.near --gas=300000000000000 >> $LOGS/all.log
near proposals | grep $POOLID >> $LOGS/all.log
near validators current | grep $POOLID >> $LOGS/all.log
near validators next | grep $POOLID >> $LOGS/all.log
EOF
Then
chmod +x /root/scripts/ping.sh
crontab -e
0 */1 * * * sh /root/scripts/ping.sh
cat /root/logs/all.log