Setting up a Shardnet Node for NEAR STAKEWARS!

sudo apt update && sudo apt upgrade -ysudo apt install -y git binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev cmake gcc g++ python docker protobuf-compiler libssl-dev pkg-config clang llvm cargo clang build-essential makesudo apt install python3-pip 
USER_BASE_BIN=$(python3 -m site --user-base)/bin export PATH="$USER_BASE_BIN:$PATH"
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash - 
sudo apt install build-essential nodejs
PATH="$PATH"
sudo npm install -g near-cli
export NEAR_ENV=shardnet 
echo ‘export NEAR_ENV=shardnet’ >> ~/.bashrc
source ~/.bashrc
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
git clone https://github.com/near/nearcore 
cd nearcore
git fetch
git checkout 0f81dca95a55f975b6e54fe6f311a71792e21698
cargo build -p neard --release --features shardnet
#check the version
~/nearcore/target/release/neard --version
~/nearcore/target/release/neard --home ~/.near init --chain-id shardnet --download-genesis 
rm ~/.near/config.json ~/.near/genesis.json
wget -O ~/.near/config.json https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/shardnet/config.json
wget -O ~/.near/genesis.json https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/shardnet/genesis.json
near login
cd ~/.near-credentials/shardnet/
cp wallet.json ~/.near/validator_key.json
nano validator_key.json
{ 
"account_id": "xx.factory.shardnet.near",
"public_key":"ed25519:HeaBJ3xLgvZacQWmEctTeUqyfSU4SDEnEwckWxd92W2G", "secret_key": "ed25519:****"
}
sudo tee /etc/systemd/system/neard.service > /dev/null <<EOF 
[Unit]
Description=NEARd Daemon Service
[Service]
Type=simple
User=$USER #Group=near
WorkingDirectory=$HOME/.near ExecStart=$HOME/nearcore/target/release/neard run
Restart=on-failure
RestartSec=30
KillSignal=SIGINT
TimeoutStopSec=45
KillMode=mixed
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload 
sudo systemctl enable neard
sudo systemctl start neard
journalctl -f -u neard
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": 5, "denominator": 100}, "code_hash":"DD428g9eqLL8fWUxv8QSpVFzyHi1Qd16P8ephYCTmMSZ"}' --accountId="<accountId>" --amount=30 --gas=300000000000000 
near call factory.shardnet.near create_staking_pool '{"staking_pool_id": "777stakes", "owner_id": "777stakes.shardnet.near", "stake_public_key": "ed25519:FS6KjVhKNaZHnwrSerQBPLJLJGYZkH66j9FNbALHWYz5", "reward_fee_fraction": {"numerator": 5, "denominator": 100}, "code_hash":"DD428g9eqLL8fWUxv8QSpVFzyHi1Qd16P8ephYCTmMSZ"}' --accountId="777stakes.shardnet.near" --amount=30 --gas=300000000000000
near proposals
near call stakes.factory.shardnet.near  deposit_and_stake --amount 1200 --accountId 777stakes.shardnet.near --gas=300000000000000
near validators current 
near validators next
nano ping.shexport NEAR_ENV=shardnet
near call 777stakes.factory.shardnet.near ping '{}' --accountId 777stakes.shardnet.near --gas=300000000000000
exit nanochmod +x ping.sh
crontab -e 
*/5 * * * * $HOME/ping.sh >> $HOME/ping.log

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store