Near Stake Wars 3

Near Validator guide

post image

Creating a wallet

Go to and create wallet.

Mandatory!!! Do not forget to save the seed phrase.

Replace the moniker with your nickname

MONIKER=<MONIKER>
POOL=$MONIKER.factory.shardnet.near
ACCOUNT_ID=$MONIKER.shardnet.near

Installing node

Install node through a script

Install a new branch version

You can find last version by this link

exempl 68bfa84ed1455f891032434d37ccad696e91e4f5
checkuot=<new_version>
wget https: //raw.githubusercontent.com/Vgk88/near_script/main/near.sh && chmod +x near_install_node.sh && bash near_install_node.sh

Update cli

sudo npm install -g near-cli

Check logs

journalctl -u neared -f -o cat

When it loads you will see the following logs

Сheck the synchronization

curl -s http ://127.0.0.1:3030/status | jq .sync_info 

If the synchronization shows false, then you can proceed to the next section

post image

Activation of node

near login
# Enter the address in the browser https ://wallet.shardnet.near.org/login/****

Confirm all requests

post image
post image
post image

Next, when you pass, you will receive a 403 Not Found error.

After that, go to the terminal and enter your ACCOUNT_ID It should look like this

post image

Creating a validator

Now create validator keys

near generate-key $ACCOUNT_ID

Make some changes in the created file

sed -i 's/private_key/secret_key/' ~/.near-credentials/shardnet/$ACCOUNT_ID.json
sed -i s/$ACCOUNT_ID/$POOL/ ~/.near-credentials/shardnet/$ACCOUNT_ID.json

Copy the key to another directory and rename it

cp ~/.near-credentials/shardnet/$ACCOUNT_ID.json ~/.near/validator_key.json

Restart the node

That's not all, in order to create a validator, we need to perform some more actions In this script we need to replace public_key with your public key

near call factory.shardnet.near create_staking_pool '{"staking_pool_id": "$MONIKER", "owner_id": "$ACCOUNT_ID", "stake_public_key": "<public key>", "reward_fee_fraction": {"numerator": 5, "denominator": 100}, "code_hash":"DD428g9eqLL8fWUxv8QSpVFzyHi1Qd16P8ephYCTmMSZ"}' --accountId="$ACCOUNT_ID" --amount=30 --gas=3000000000000000

You also need to throw the appropriate amount so that the validator is in the valid set

near call $MONIKER deposit_and_stake --amount <amount> --accountId $ACCOUNT_ID --gas=300000000000000

Other commands that may be needed

Unstake and Unstake All

near call <staking_pool_id> unstake '{"amount": "<amount yoctoNEAR>"}' --accountId <accountId> --gas=300000000000000
near call <staking_pool_id> unstake_all --accountId <accountId> --gas=300000000000000

Withdraw or Withdraw the entire amount.

near call <staking_pool_id> withdraw '{"amount": "<amount yoctoNEAR>"}' --accountId <accountId> --gas=300000000000000
near call <staking_pool_id> withdraw_all --accountId <accountId> --gas=300000000000000

Available for withdrawal. You can withdraw funds from the contract only if it is unlocked.

near view <staking_pool_id> is_account_unstaked_balance_available '{"account_id": "<accountId>"}'

View stake balance.

near view <staking_pool_id> get_account_staked_balance '{"account_id": "<accountId>"}'

Spreading the balance

near view <staking_pool_id> get_account_unstaked_balance '{"account_id": "<accountId>"}'

We create a ping

Install such a script

wget -P ~/ https ://raw.githubusercontent.com/MaxMavaIll/near_guide/main/ping.sh && chmod +x ~/ping.sh
mkdir -p $HOME/logs

Install crontab if you do not have it installed and open the editor where we will make changes

apt install crontab
crontab -e

If you have not used it before, you will be given a choice of which editor to use (I will use nano) Now we insert the following phrase at the end of the list

0 */2 * * * bash /root/ping.sh

To see the logs of these commands, you need to run

nano ~/logs/all.log