Skip to content

New guide for validator#118

Merged
staffik merged 27 commits intonear:mainfrom
DDeAlmeida:main
Apr 3, 2025
Merged

New guide for validator#118
staffik merged 27 commits intonear:mainfrom
DDeAlmeida:main

Conversation

@DDeAlmeida
Copy link
Contributor

No description provided.

@DDeAlmeida
Copy link
Contributor Author

@walnut-the-cat
@staffik
@ilblackdragon
Please approve the new Validator Guide

Add Config.json link for Mainnet - Validator
Copy link
Contributor

@staffik staffik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @DDeAlmeida!
The content looks good, but the formatting needs improvement.


During the building time, let's make a wallet.

We recommand to use a partner wallet like Meteor, MyNearWallet or SenderWallet.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recommend


https://wallet.meteorwallet.app/

![](file:///C:/Users/ddealmeida/Downloads/wallet_creation.png)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local path, here and in other places


#### Wallet Authorization

A full access key needs to be installed locally to be able transactions via NEAR-CLI.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"to be able to send transactions"

Comment on lines +374 to +375
near contract call-function as-transaction pool-details.near update_field json-args '{"pool_id": "<full_pool_id>", "name": "name", "value": "PandaPool"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' sign-as <accountId> network-config mainnet sign-with-keychain
near contract call-function as-transaction pool-details.near update_field json-args '{"pool_id": "<full_pool_id>", "name": "description", "value": "PandaPool Description"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' sign-as <accountId> network-config mainnet sign-with-keychain
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please format as code, here and below

Comment on lines +388 to +392
You can use:
Discord: https://discord.gg/nearprotocol
Telegram: https://t.me/near_validators
X: https://x.com/NEARChainStatus (Only Mainnet)
Email : https://near.us14.list-manage.com/subscribe?u=faedf5dec8739fb92e05b4131&id=befd133f18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When rendered, it is all in one line


Make sure the config file have store.load_mem_tries_for_tracked_shards with true value

#### Usefull links:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useful

DDeAlmeida and others added 5 commits February 24, 2025 16:32
Copy link
Contributor

@staffik staffik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DDeAlmeida I changed the formatting, PTAL.

Copy link
Contributor

@VanBarbascu VanBarbascu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DDeAlmeida, thanks for taking the time to update the docs!
I left a couple of suggestions. Please take a look

Comment on lines +169 to +184
curl -s -X POST https://rpc.mainnet.near.org -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"method": "network_info",
"params": [],
"id": "dontcare"
}' | \
jq --arg newBootNodes "$(curl -s -X POST https://rpc.mainnet.near.org -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"method": "network_info",
"params": [],
"id": "dontcare"
}' | jq -r '.result.active_peers as $list1 | .result.known_producers as $list2 |
$list1[] as $active_peer | $list2[] |
select(.peer_id == $active_peer.id) |
"\(.peer_id)@\($active_peer.addr)"' | paste -sd "," -)" \
'.network.boot_nodes = $newBootNodes' ~/.near/config.json > ~/.near/config.tmp && mv ~/.near/config.json ~/.near/config.json.backup && mv ~/.near/config.tmp ~/.near/config.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple of redundant commands there. It is cleaner this way:

Suggested change
curl -s -X POST https://rpc.mainnet.near.org -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"method": "network_info",
"params": [],
"id": "dontcare"
}' | \
jq --arg newBootNodes "$(curl -s -X POST https://rpc.mainnet.near.org -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"method": "network_info",
"params": [],
"id": "dontcare"
}' | jq -r '.result.active_peers as $list1 | .result.known_producers as $list2 |
$list1[] as $active_peer | $list2[] |
select(.peer_id == $active_peer.id) |
"\(.peer_id)@\($active_peer.addr)"' | paste -sd "," -)" \
'.network.boot_nodes = $newBootNodes' ~/.near/config.json > ~/.near/config.tmp && mv ~/.near/config.json ~/.near/config.json.backup && mv ~/.near/config.tmp ~/.near/config.json
BOOT_NODES=$(curl -s -X POST https://rpc.mainnet.near.org -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"method": "network_info",
"params": [],
"id": "dontcare"
}' | jq -r '.result.active_peers as $list1 | .result.known_producers as $list2 |
$list1[] as $active_peer | $list2[] |
select(.peer_id == $active_peer.id) |
"\(.peer_id)@\($active_peer.addr)"' | paste -sd "," -)
jq --arg newBootNodes $BOOT_NODES '.network.boot_nodes = $newBootNodes' ~/.near/config.json > ~/.near/config.tmp && mv ~/.near/config.json ~/.near/config.json.backup && mv ~/.near/config.tmp ~/.near/config.json

- `<accountId>` or `accountId` – `xxx.near`, where `xxx` is your account name, for example `validator_near.near`.

```sh
cd ~/nearcore && target/release/neard init --chain-id="mainnet" --account-id=<full_pool_id>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add these lines here to download the latest config.json and to configure the boot nodes to facilitate the epoch sync.

Suggested change
cd ~/nearcore && target/release/neard init --chain-id="mainnet" --account-id=<full_pool_id>
# You can use any RPC provider for this command.
BOOT_NODES=$(curl -s -X POST https://rpc.mainnet.near.org -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"method": "network_info",
"params": [],
"id": "dontcare"
}' | jq -r '.result.active_peers as $list1 | .result.known_producers as $list2 |
$list1[] as $active_peer | $list2[] |
select(.peer_id == $active_peer.id) |
"\(.peer_id)@\($active_peer.addr)"' | paste -sd "," -)
cd ~/nearcore && target/release/neard init --chain-id="mainnet" --account-id=<full_pool_id> --download-genesis --download-config validator --boot-nodes $BOOT_NODES


#### Update `config.json` to activate the validator config
```sh
sed -i 's/"tracked_shards": \[\s*0\s*\]/"tracked_shards": []/' ~/.near/config.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep it consistent and use jq for any amendments to the config.json files. This is because the tracked_shards may not be in the config.json file. Also, this commands assumes the previous value of the field, which may not be '[0]' all the time.

If the user follows the init command that I suggested above, the config is already dedicated to the validator node so there is no need to overwrite it.


[Service]
Type=simple
User=root
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do encourage operation of any service under the root user. Leave a comment here to change User to a dedicated one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't want to change this Service, add a warning at the top of it about the risk of running services as root.
I cannot start to enumerate the disadvantages. There are both operational and security implications.
If the user opts for a dedicated vm/docker for this service, there are still some security concerns.


Now you only need to have enough token staked to start earning Rewards.

#### Network optimizations
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move/reference this in the node startup instructions.

DDeAlmeida and others added 2 commits March 14, 2025 08:51
Co-authored-by: Razvan Barbascu <r.barbascu@gmail.com>
@DDeAlmeida
Copy link
Contributor Author

@VanBarbascu doc updated

Copy link
Contributor

@VanBarbascu VanBarbascu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff! Please address these 2 commens and we are good to go.

Copy link
Contributor

@VanBarbascu VanBarbascu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I committed those changes as they were quite trivial.

@DDeAlmeida
Copy link
Contributor Author

I committed those changes as they were quite trivial.

Thank, i was going this right now ;)

@staffik staffik merged commit 3ffc804 into near:main Apr 3, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants