GithubHelp home page GithubHelp logo

my-simple-guide-to-creating-a-near-stake-wars-iii-node's Introduction

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.

Task 1

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.

Task 2

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. enter image description here

Then select a server with suitable parameters. enter image description here

I ordered a server from Hetzner with the parameters: vCPU8, AMD/RAM16GB, Disk space 240GB for โ‚ฌ 27.25.

Task 3.

Let's move to the most difficult and demanding step

Installing NEAR-CLI

sudo apt update -y && sudo apt upgrade -y

Installing Node.js, and npm

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

Installing NEAR-CLI

sudo npm install -g near-cli

Validator Stats

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

Task 3.

Checking confirm CPU

lscpu | grep -P '(?=.*avx )(?=.*sse4.2 )(?=.*cx16 )(?=.*popcnt )' > /dev/null \

&& echo "Supported" \

|| echo "Not supported"

Installing 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

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

Installing Rust & Cargo

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

source $HOME/.cargo/env

Task 4.

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

Compiling nearcore binary

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

Replace the config

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)

Task 5.

Runing the node

cd ~/nearcore  
./target/release/neard --home ~/.near run

Task 6.

Activating the node as validator

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

Task 7.

Deploy a Staking Pool

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

Deposit and Stake NEAR

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

Ping

Task 8.

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

Task 9.

Make directory

mkdir -p ~/scripts

mkdir -p ~/logs

cat <<'EOF' | sudo tee /root/scripts/ping.sh

#!/bin/sh

Task 10.

Ping call to renew Proposal added to crontab

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

You have completed the installation of the NEAR Shardnet node. You are sure to be successful. Keep going!

my-simple-guide-to-creating-a-near-stake-wars-iii-node's People

Contributors

alexongotos avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.