Skip to content

Commit

Permalink
Add different config files info
Browse files Browse the repository at this point in the history
  • Loading branch information
telezhnaya committed Dec 12, 2024
1 parent 21f5e55 commit 4426a0e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
27 changes: 23 additions & 4 deletions docs/validator/compile-and-run-a-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,25 @@ $ ./target/release/neard --home ~/.near init --chain-id testnet --download-genes
> You can skip the `--home` argument if you are fine with the default working directory in `~/.near`. If not, pass your preferred location.
This command will create the required directory structure and will generate `config.json`, `node_key.json`, and `genesis.json` files for `testnet` network.
- `config.json` - Configuration parameters which are responsive for how the node will work. This file should contain the following fields critical for validator nodes:
- `"tracked_shards": []` - to enable single-shard tracking. The shard the validator should track will be assigned by the protocol.
- `genesis.json` - A file with all the data the network started with at genesis. This contains initial accounts, contracts, access keys, and other records which represents the initial state of the blockchain.
- `node_key.json` - A file which contains a public and private key for the node. Also includes an optional `account_id` parameter.
- `data/` - A folder in which a NEAR node will write it's state.
- `config.json` - should be replaced with one of the files listed below, see p.3.1

> **Heads up**
> The genesis file for `testnet` is big (6GB +) so this command will be running for a while and no progress will be shown.

#### 3.1 Set up the config file for your needs

We have created basic configuration files for different purposes.
The default file works well for any use case on localnet.

For testnet, the default file should be replaced with one of the following, depending on your requirements:

1. [Regular RPC Node](https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/testnet/rpc/config.json) stores recent info for all the shards, and can serve RPC queries for the last N epochs (N=5 by default).
2. [Archival RPC Node](https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/testnet/archival/config.json) stores all the info starting for genesis, can serve RPC queries for the entire history. Requires significant storage.
3. [Validator Node](https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/testnet/validator/config.json) is designed for the validators. Heavily optimized, does not store the full state, and cannot serve RPC queries.

### 4. Get data backup {#get-data-backup}

The node is ready to be started. When started as-is, it will establish
Expand Down Expand Up @@ -441,12 +451,21 @@ $ ./target/release/neard --home ~/.near init --chain-id mainnet --download-confi
> You can skip the `--home` argument if you are fine with the default working directory in `~/.near`. If not, pass your preferred location.
This command will create the required directory structure by generating a `config.json`, `node_key.json`, and downloads a `genesis.json` for `mainnet`.
- `config.json` - Configuration parameters which are responsive for how the node will work. This file should contain the following fields critical for validator nodes:
- `"tracked_shards": []` - to enable single-shard tracking. The shard the validator should track will be assigned by the protocol.
- `genesis.json` - A file with all the data the network started with at genesis. This contains initial accounts, contracts, access keys, and other records which represents the initial state of the blockchain.
- `node_key.json` - A file which contains a public and private key for the node. Also includes an optional `account_id` parameter which is required to run a validator node (not covered in this doc).
- `data/` - A folder in which a NEAR node will write it's state.
- `config.json` - should be replaced with one of the files listed below, see p.3.1

#### 3.1 Set up the config file for your needs

We have created basic configuration files for different purposes.
The default file works well for any use case on localnet.

For mainnet, the default file should be replaced with one of the following, depending on your requirements:

1. [Regular RPC Node](https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/rpc/config.json) stores recent info for all the shards, and can serve RPC queries for the last N epochs (N=5 by default).
2. [Archival RPC Node](https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/archival/config.json) stores all the info starting for genesis, can serve RPC queries for the entire history. Requires significant storage.
3. [Validator Node](https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/validator/config.json) is designed for the validators. Heavily optimized, does not store the full state, and cannot serve RPC queries.

### 4. Get data backup {#get-data-backup-1}

Expand Down
4 changes: 2 additions & 2 deletions docs/validator/deploy-on-mainnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ Once the daemon is built, node is initialized and staking pool
created, the validator can be started. To make sure the node has been
set up correctly, check that the configuration file located at
`~/.near/config.json` is the same as [this mainnet
config.json](https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/config.json):
config.json](https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/validator/config.json):

```bash
sha1sum <~/.near/config.json
curl -s https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/config.json | sha1sum
curl -s https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/validator/config.json | sha1sum
```

If everything is in order, start your node with the following command:
Expand Down
14 changes: 5 additions & 9 deletions docs/validator/validator-bootcamp.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,9 @@ This command will create the directory structure and will generate `config.json`

### Replace the `config.json`

From the generated `config.json`, there two parameters to modify:
- `boot_nodes`: If you had not specify the boot nodes to use during init in Step 3, the generated `config.json` shows an empty array, so we will need to replace it with a full one specifying the boot nodes.
- `tracked_shards`: In the generated `config.json`, this field is an empty empty. You will have to replace it to `"tracked_shards": [0]`

```
rm ~/.near/config.json
wget -O ~/.near/config.json https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/<network>/config.json
wget -O ~/.near/config.json https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/<network>/validator/config.json
```

### Get data backup
Expand Down Expand Up @@ -405,7 +401,7 @@ For Testnet

```
cd ~/.near/testnet
wget -c https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/testnet/config.json
wget -c https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/testnet/validator/config.json
wget -c https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/testnet/genesis.json
```

Expand Down Expand Up @@ -621,7 +617,7 @@ near login
mkdir ~/.near
cd ~/.near
wget -c https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/genesis.json
wget -c https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/config.json
wget -c https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/validator/config.json
```
* Download the latest snapshot from [the snapshot page](/intro/node-data-snapshots).

Expand Down Expand Up @@ -1504,8 +1500,8 @@ INFO stats: #42376888 Waiting for peers 0/0/40 peers ⬇ 0 B/s ⬆ 0 B/s 0.00 bp

**Resolution**
Download the latest config.json file and restart:
- For Testnet: `https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/testnet/config.json`
- For Mainnet: `https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/config.json`
- For Testnet: `https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/testnet/validator/config.json`
- For Mainnet: `https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/validator/config.json`


## LESSON 7 - NODE FAILOVER
Expand Down

0 comments on commit 4426a0e

Please sign in to comment.