# Near Stake Wars 3

By [cyberG|DVS](https://paragraph.com/@cyberg) · 2022-09-07

---

Near Validator guide
====================

![](https://storage.googleapis.com/papyrus_images/0d1ed25f550f98186a4b0d6c95c1e086699cf7314600b88a17435bde9c19d6cf.png)

Creating a wallet
-----------------

Go [to](https://wallet.shardnet.near.org/) 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](https://github.com/near/stakewars-iii/blob/main/commit.md)

    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

![](https://storage.googleapis.com/papyrus_images/9da59035a6d794dacace723a1eaac4ed90b0d2267dd97d9c94b6c38f83e49c1d.png)

Activation of node
------------------

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

Confirm all requests

![](https://storage.googleapis.com/papyrus_images/b76b421919e1189cb5590a74a4defd96290541224a4de009bbd7697b98cfc405.png)

![](https://storage.googleapis.com/papyrus_images/23ff698ea57e6217fa19a15fcba72a6c5a538d49e52a219cc4a81700ddc85c0b.png)

![](https://storage.googleapis.com/papyrus_images/eef7f3de2848fceed91b9fcb2c38ebfcabc3dd7a805352499667fcebc81364c2.png)

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

![](https://storage.googleapis.com/papyrus_images/184bebeca2d865bc15702d9b56235d746a2c8e53d13e5f74702bde2f0ad93aa3.png)

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

---

*Originally published on [cyberG|DVS](https://paragraph.com/@cyberg/near-stake-wars-3)*
