Hardware | Chunk-Only Producer Specifications |
---|---|
CPU | 4-Core Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz |
RAM | 16G |
Storage | 320GB SSD |
ubuntu@ip-172-26-8-107:~$ uname -a
Linux ip-172-26-8-107 5.15.0-1015-aws #19~20.04.1-Ubuntu SMP Wed Jun 22 19:07:51 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
80usd/methons
This chapter is the simplest, mainly about installing node js、npm、near-cli。 Then use near cli commands
# update apt package
sudo apt update && sudo apt upgrade -y
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install build-essential nodejs
PATH="$PATH"
ubuntu@ip-172-26-8-107:~$ node -v
v18.6.0
ubuntu@ip-172-26-8-107:~$ npm -v
8.13.2
# global install
sudo npm install -g near-cli
The environment will need to be set each time a new shell is launched to select the correct network.
- GuildNet
- TestNet
- MainNet
- Shardnet (this is the network we will use for Stake Wars)
# set network tmp env
export NEAR_ENV=shardnet
you can also set env profile
echo 'export NEAR_ENV=shardnet' >> ~/.bashrc
# source
source ~/.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.
ubuntu@ip-172-26-8-107:~$ near proposals
Proposals for the epoch after next (new: 50, passing: 118, expected seat price = 530)
.--------------------------------------------------------------------------------------------------.
| Status | Validator | Stake => New Stake | # Seats |
|--------------------|------------------------------------------|------------------------|---------|
| Proposal(Accepted) | benji.factory.shardnet.near | 2,650,781 => 2,650,781 | 1 |
| Rollover | boot2.near | 2,000,000 | 1 |
| Rollover | boot1.near | 1,000,000 | 1 |
| Rollover | seb.factory.shardnet.near | 98,892 | 1 |
| Rollover | abahmane.factory.shardnet.near | 85,222 | 1 |
| Rollover | boot4.near | 79,930 | 1 |
| Rollover | idea404.factory.shardnet.near | 69,421 | 1 |
| Rollover | boot3.near | 16,212 | 1 |
| Rollover | hj-pos.factory.shardnet.near | 15,000 | 1 |
| Proposal(Accepted) | stakewars-de-1.factory.shardnet.near | 10,199 => 10,199 | 1 |
| Rollover | kiln.factory.shardnet.near | 7,264 | 1 |
| Proposal(Accepted) | xpool.factory.shardnet.near | 7,030 => 7,030 | 1 |
| Proposal(Accepted) | scholtz.factory.shardnet.near | 6,030 => 6,030 | 1 |
| Proposal(Accepted) | ou812.factory.shardnet.near | 5,978 => 5,978 | 1 |
| Proposal(Accepted) | nodeverse.factory.shardnet.near | 5,730 | 1 |
| Proposal(Accepted) | idtcn0.factory.shardnet.near | 5,530 => 5,530 | 1 |
| Proposal(Accepted) | maz0.factory.shardnet.near | 5,030 => 5,030 | 1 |
| Rollover | dwrx.factory.shardnet.near | 5,003 | 1 |
| Proposal(Accepted) | argentina-hub-pool.factory.shardnet.near | 4,830 | 1 |
| Rollover | 42tech.factory.shardnet.near | 4,700 | 1 |
| Rollover | armada.factory.shardnet.near | 4,530 | 1 |
| Rollover | beestake.factory.shardnet.near | 4,470 | 1 |
| Proposal(Accepted) | gigachad.factory.shardnet.near | 4,020 | 1 |
| Proposal(Accepted) | stakewars-de-2.factory.shardnet.near | 3,998 => 3,998 | 1 |
| Proposal(Accepted) | alpha-centauri.factory.shardnet.near | 3,990 => 3,990 | 1 |
| Proposal(Accepted) | vitalpointai.factory.shardnet.near | 1,990 => 3,985 | 1 |
| Rollover | duonghb.factory.shardnet.near | 3,940 | 1 |
| Rollover | baf.factory.shardnet.near | 3,930 | 1 |
| Proposal(Accepted) | jiangwei.factory.shardnet.near | 3,915 => 3,915 | 1 |
| Rollover | imiroslav.factory.shardnet.near | 3,820 | 1 |
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.
ubuntu@ip-172-26-8-107:~$ near validators current
Validators (total: 107, seat price: 530):
.--------------------------------------------------------------------------------------------------------------------------------------------------.
| Validator Id | Stake | # Seats | % Online | Blocks produced | Blocks expected | Chunks produced | Chunks expected |
|-----------------------------------------|-----------|---------|----------|-----------------|-----------------|-----------------|-----------------|
| benji.factory.shardnet.near | 2,650,781 | 1 | 99.96% | 922 | 923 | 2133 | 2133 |
| boot2.near | 2,000,000 | 1 | 99.51% | 713 | 727 | 2133 | 2133 |
| boot1.near | 1,000,000 | 1 | 99.91% | 330 | 330 | 2131 | 2133 |
| seb.factory.shardnet.near | 98,892 | 1 | 0% | 0 | 35 | 0 | 348 |
| abahmane.factory.shardnet.near | 85,222 | 1 | 100% | 31 | 31 | 296 | 296 |
| boot4.near | 79,930 | 1 | 99.34% | 29 | 29 | 276 | 278 |
| idea404.factory.shardnet.near | 69,421 | 1 | 100% | 22 | 22 | 234 | 234 |
| boot3.near | 16,212 | 1 | 96.29% | 7 | 7 | 45 | 47 |
| hj-pos.factory.shardnet.near | 15,000 | 1 | 100% | 8 | 8 | 51 | 51 |
| stakewars-de-1.factory.shardnet.near | 10,199 | 1 | 100% | 1 | 1 | 54 | 54 |
| kiln.factory.shardnet.near | 7,264 | 1 | 100% | 2 | 2 | 39 | 39 |
| xpool.factory.shardnet.near | 7,030 | 1 | 96.55% | 4 | 4 | 24 | 25 |
| scholtz.factory.shardnet.near | 6,030 | 1 | 100% | 3 | 3 | 16 | 16 |
| ou812.factory.shardnet.near | 5,978 | 1 | 100% | 5 | 5 | 31 | 31 |
| idtcn0.factory.shardnet.near | 5,530 | 1 | 100% | 0 | 0 | 14 | 14 |
| maz0.factory.shardnet.near | 5,030 | 1 | 100% | 1 | 1 | 15 | 15 |
This shows validators whose proposal was accepted one epoch ago, and that will enter the validator set in the next epoch.
ubuntu@ip-172-26-8-107:~$ near validators next
Next validators (total: 100, seat price: 530):
.-----------------------------------------------------------------------------------------.
| Status | Validator | Stake | # Seats |
|------------|-----------------------------------------|------------------------|---------|
| New | june07.factory.shardnet.near | 13,030 | 1 |
| New | onehis.factory.shardnet.near | 2,010 | 1 |
| New | nuclear.factory.shardnet.near | 1,998 | 1 |
| New | ir.factory.shardnet.near | 1,998 | 1 |
| New | satman.factory.shardnet.near | 1,930 | 1 |
| New | azure.factory.shardnet.near | 1,830 | 1 |
| New | magicpowered.factory.shardnet.near | 1,530 | 1 |
| New | macveriz.factory.shardnet.near | 1,530 | 1 |
| New | withouthand.factory.shardnet.near | 1,430 | 1 |
| New | ouiouane-01.factory.shardnet.near | 1,425 | 1 |
| New | monish016.factory.shardnet.near | 1,139 | 1 |
| Rewarded | benji.factory.shardnet.near | 2,650,781 -> 2,650,781 | 1 |
| Rewarded | abahmane.factory.shardnet.near | 85,222 -> 85,222 | 1 |
| Rewarded | stakewars-de-1.factory.shardnet.near | 10,199 -> 10,199 | 1 |
| Rewarded | kiln.factory.shardnet.near | 7,264 -> 7,264 | 1 |
| Rewarded | xpool.factory.shardnet.near | 7,030 -> 7,030 | 1 |
| Rewarded | scholtz.factory.shardnet.near | 6,030 -> 6,030 | 1 |
| Rewarded | ou812.factory.shardnet.near | 5,978 -> 5,978 | 1 |
| Rewarded | idtcn0.factory.shardnet.near | 5,530 -> 5,530 | 1 |
| Rewarded | maz0.factory.shardnet.near | 5,030 -> 5,030 | 1 |
| Rewarded | beestake.factory.shardnet.near | 4,470 -> 4,470 | 1 |
| Rewarded | stakewars-de-2.factory.shardnet.near | 3,998 -> 3,998 | 1 |
| Rewarded | baf.factory.shardnet.near | 3,930 -> 3,930 | 1 |
| Rewarded | jiangwei.factory.shardnet.near | 3,915 -> 3,915 | 1 |
| Rewarded | legrev.factory.shardnet.near | 2,730 -> 3,130 | 1 |
| Rewarded | spin.factory.shardnet.near | 2,990 -> 2,990 | 1 |
| Rewarded | stingray.factory.shardnet.near | 2,495 -> 2,495 | 1 |
| Rewarded | pero_pool.factory.shardnet.near | 2,491 -> 2,491 | 1 |
| Rewarded | gruberx.factory.shardnet.near | 2,488 -> 2,488 | 1 |
| Rewarded | zentria0.factory.shardnet.near | 2,480 -> 2,480 | 1 |
| Rewarded | senseinode.factory.shardnet.near | 2,307 -> 2,307 | 1 |
| Rewarded | do0k13.factory.shardnet.near | 1,998 -> 1,998 | 1 |
| Rewarded | stakefarm.factory.shardnet.near | 1,995 -> 1,995 | 1 |
| Rewarded | gateomega.factory.shardnet.near | 1,995 -> 1,995 | 1 |
| Rewarded | vitalpointai.factory.shardnet.near | 1,990 -> 1,990 | 1 |
| Rewarded | bondedzone.factory.shardnet.near | 1,990 -> 1,990 | 1 |
| Rewarded | vas.factory.shardnet.near | 1,963 -> 1,963 | 1 |
| Rewarded | realblocks0.factory.shardnet.near | 1,930 -> 1,930 | 1 |
| Rewarded | openbitlab.factory.shardnet.near | 1,930 -> 1,930 | 1 |
| Rewarded | alien.factory.shardnet.near | 1,930 -> 1,930 | 1 |
| Rewarded | marmaj.factory.shardnet.near | 1,914 -> 1,914 | 1 |
| Rewarded | markelov.factory.shardnet.near | 1,830 -> 1,830 | 1 |
| Rewarded | jagon.factory.shardnet.near | 1,820 -> 1,820 | 1 |
| Rewarded | ynot.factory.shardnet.near | 1,740 -> 1,740 | 1 |
| Rewarded | one1000lakes.factory.shardnet.near | 1,730 -> 1,730 | 1 |
| Rewarded | cunum.factory.shardnet.near | 1,530 -> 1,530 | 1 |
| Rewarded | shurik.factory.shardnet.near | 1,530 -> 1,530 | 1 |
| Rewarded | xrl.factory.shardnet.near | 1,530 -> 1,530 | 1 |
| Rewarded | leadnode.factory.shardnet.near | 1,030 -> 1,530 | 1 |
| Rewarded | readylayeronespac.factory.shardnet.near | 1,500 -> 1,500 | 1 |
| Rewarded | cryptogarik.factory.shardnet.near | 1,330 -> 1,330 | 1 |
| Rewarded | kserx.factory.shardnet.near | 1,330 -> 1,330 | 1 |
| Rewarded | kalakendradao.factory.shardnet.near | 1,031 -> 1,031 | 1 |
| Rewarded | tamago-pool0.factory.shardnet.near | 1,030 -> 1,030 | 1 |
| Rewarded | dimv.factory.shardnet.near | 1,030 -> 1,030 | 1 |
| Rewarded | herostake.factory.shardnet.near | 1,030 -> 1,030 | 1 |
| Rewarded | stakin.factory.shardnet.near | 1,030 -> 1,030 | 1 |
| Rewarded | secdec.factory.shardnet.near | 1,020 -> 1,020 | 1 |
| Rewarded | max_p_node.factory.shardnet.near | 999 -> 999 | 1 |
| Rewarded | pool2-lovali.factory.shardnet.near | 530 -> 530 | 1 |
| Kicked out | seb.factory.shardnet.near | - | - |
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.
Before you start, you may want to confirm that your machine has the right CPU features.
# install lscpu
apt install util-linux
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 build-essential make libiberty-dev cmake gcc g++ python docker.io protobuf-compiler libssl-dev pkg-config clang llvm cargo
sudo apt install python3-pip
Set the configuration
USER_BASE_BIN=$(python3 -m site --user-base)/bin
export PATH="$USER_BASE_BIN:$PATH"
Note: if the version of rust1.59.0 is installed by default on this computer, you need to install the new version to make the environment variables take effect
ubuntu@ip-172-26-8-107:~$ /bin/rustc -V
rustc 1.59.0
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
please,input y
,continue install rust
please input 1
,continue install。
source $HOME/.cargo/env
git clone -b master https://github.com/near/nearcore
In the nearcore
folder run the following commands:
cargo build -p neard --release --features shardnet
build will take some time. Wait a moment。finish。neard
in target/release
dir
ubuntu@ip-172-26-8-107:~/code/nearcore$ ls target/release/
build deps examples incremental neard neard.d
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
rm ~/.near/config.json
wget -O ~/.near/config.json https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/shardnet/config.json
sed -e 's/"archive": false/"archive": true/' -i config.json
Install AWS Cli
sudo apt-get install awscli -y
Download snapshot
cd ~/.near
# download
aws s3 --no-sign-request cp s3://build.openshards.io/stakewars/shardnet/data.tar.gz .
# tar
tar -xzvf data.tar.gz
# remove snapshot
rm -rf data.tar.gz
cd nearcore
./target/release/neard --home ~/.near run
The node is now running you can see log outputs in your console. Your node should be find peers, download headers to 100%, and then download blocks.if 100%,you can stop node。
login
near login
Then copy the displayed link to the browser, open it, and then log in to Shardnet wallet. If there is no account, create one, After clicking confirm, return to the near login console interface and pause there. We need to enter the account ID, enter, and login success. Let's check whether the credentials exist. There should be a ${accountid} JSON file
ubuntu@ip-172-26-8-107:~/code/nearcore$ ls ~/.near-credentials/shardnet/
eth.shardnet.near.json
cp the credentials json filevalidator_key.json
# XXX is the file just generated after login successful
cp ~/.near-credentials/shardnet/xxx.json ~/.near/validator_key.json
editvalidator_key.json
- Edit “account_id” => xx.factory.shardnet.near, where xx is your PoolName
- Change private_key to secret_key
File content must be in the following pattern:
if you accountID is abc.shardnet.near
,the validator_key.json account_id filed is abc.factory.shardnet.near
。
{
"account_id":"xxx.factory.shardnet.near",
"public_key":"ed25519:Coqwefqumi1yCgAUAUfuWtzJXbHEzebS5RRPjvhqMbpV",
"secret_key":"ed25519:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
start validator node create neard systems service
sudo vi /etc/systemd/system/neard.service
Paste:
[Unit]
Description=NEARd Daemon Service
[Service]
Type=simple
User=ubuntu
#Group=near
WorkingDirectory=/home/ubuntu/.near
ExecStart=/home/ubuntu/code/nearcore/target/release/neard run
Restart=on-failure
RestartSec=30
KillSignal=SIGINT
TimeoutStopSec=45
KillMode=mixed
[Install]
WantedBy=multi-user.target
notice:WorkingDirectory is replace your dir,ExecStart Indicates the path of your program. The code has been cloned and compiled before. It should be that path.
# Automatic startup
sudo systemctl enable neard
# start
sudo systemctl start neard
# get status
sudo systemctl status neard
# watch logs
journalctl -n 100 -f -u neard
Deploy a new staking pool for your validator. Do operations on your staking pool to delegate and stake NEAR.
near call factory.shardnet.near create_staking_pool '{"staking_pool_id": "<pool id>", "owner_id": "<accountId>", "stake_public_key": "<public key>", "reward_fee_fraction": {"numerator": 1, "denominator": 100}, "code_hash":"DD428g9eqLL8fWUxv8QSpVFzyHi1Qd16P8ephYCTmMSZ"}' --accountId="<accountId>" --amount=30 --gas=300000000000000
- pool_id:if you accountID is
abc.shardnet.near
,thepool_id
is abc - owner_id: you accountID is
abc.shardnet.near
,theaccountId
isabc.shardnet.near
- public key:field
public_key
field invalidator_key.json
- accountId:The SHARDNET account deploying and signing the mount tx. Usually the same as the Owner ID.
- reward_fee_fraction:fee,1/100,1%
example:
near call factory.shardnet.near create_staking_pool '{"staking_pool_id": "jiangwei", "owner_id": "jiangwei.shardnet.near", "stake_public_key": "ed25519:Coqwefqumi1yCgAUAUfuWtzJXbHEzebS5RRPjvhqMbpV", "reward_fee_fraction": {"numerator": 1, "denominator": 100}, "code_hash":"DD428g9eqLL8fWUxv8QSpVFzyHi1Qd16P8ephYCTmMSZ"}' --accountId="jiangwei.shardnet.near" --amount=30 --gas=300000000000000
Check whether your verifier is displayed in the block browser ShardNet Validator Node
use jiangwei.shardnet.near account stake 999 NEAR to jiangwei.factory.shardnet.near.
accountID=jiangwei.shardnet.near
amount=999
near call jiangwei.factory.shardnet.near deposit_and_stake --amount $amount --accountId $accountID --gas=300000000000000
A ping issues a new proposal and updates the staking balances for your delegators. A ping should be issued each epoch to keep reported rewards current
near call <staking_pool_id> ping '{}' --accountId <accountId> --gas=300000000000000
we can create cron job
ubuntu@ip-172-26-8-107:~$ cat near_ping.sh
NEAR_ENV=shardnet near call jiangwei.factory.shardnet.near ping '{}' --accountId jiangwei.shardnet.near --gas=300000000000000
ubuntu@ip-172-26-8-107:~$ crontab -e
# auto Ping once every 5 minutes
*/5 * * * * nohup ~/near_ping.sh >> ~/near_ping.log 2>&1 &
Becoming a verifier is not immediately visible. After creating a take pool, the status should be proposal and being added: If everything is normal, the next epoch will be effective. At present, it is about 2 hours an epoch. if desplay Validator, it is effective