Skip to content

Commit

Permalink
Update node-operators.mdx
Browse files Browse the repository at this point in the history
Overall cleanup
  • Loading branch information
cordt-sei authored Nov 10, 2024
1 parent 8a9557b commit 0d085ce
Showing 1 changed file with 91 additions and 140 deletions.
231 changes: 91 additions & 140 deletions pages/dev-node/node-operators.mdx
Original file line number Diff line number Diff line change
@@ -1,197 +1,148 @@
import { Callout } from "nextra/components";
import VersionTable from '../../components/VersionFetcher/VersionTable';

# Sei Node Setup Guide
# Sei Node Setup

## System Requirements

| CPU Cores | RAM | Disk |
|-----------|------|----------|
| 16 cores | 64GB | 1TB NVMe |

### Build Version and Genesis Table

<VersionTable />

## Getting Started

*The following is intended for Debian-based systems. Others like MacOS or Archlinux will differ slightly*
*The following instructions are for Debian-based systems. Other operating systems like macOS or Arch will use a slightly different procedure.*

#### Update and Upgrade System Packages
### Update and Upgrade System Packages

```bash
apt update && apt upgrade -y
sudo apt update && sudo apt upgrade -y
```

#### Install Dependencies [use a package manager like `apt`]
### Install Dependencies

```bash
apt install nano make build-essential gcc git jq chrony tar curl lz4 wget -y
sudo apt install nano make build-essential gcc git jq chrony tar curl lz4 wget -y
```

#### Install Golang [do not use a package manager for this step]
### Install Golang

1. Remove old Go version if necessary:

```bash
rm -rvf /usr/local/go/
```
```bash
sudo rm -rvf /usr/local/go/
```

2. Install Golang:

```bash
wget https://golang.org/dl/go1.21.1.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.21.1.linux-amd64.tar.gz
rm go1.21.1.linux-amd64.tar.gz
```
```bash
wget https://go.dev/dl/go1.21.1.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.21.1.linux-amd64.tar.gz
rm go1.21.1.linux-amd64.tar.gz
```

3. Configure PATH and GOPATH (add to `~/.profile` or `~/.bashrc` to make persistent):

```bash
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GO111MODULE=on
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
```
```bash
echo 'export GOROOT=/usr/local/go' >> ~/.profile
echo 'export GOPATH=$HOME/go' >> ~/.profile
echo 'export GO111MODULE=on' >> ~/.profile
echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> ~/.profile
source ~/.profile
```

#### Install `seid`
### Install `seid`

1. Define the variables for your network and (optional) a moniker or name to assign your node:
*Replace these with real values, found in the [reference table](/node-operators#build-version-and-genesis-table) above*
1. Define the variables for your network and (optional) moniker:

```bash
VERSION=v1.2.3
CHAIN_ID=mainnet-1
GENESIS_URL=https://raw.githubusercontent.com/sei-protocol/testnet/main/pacific-1/genesis.json
MONIKER="your node name"
```
```bash
VERSION=v1.2.3
CHAIN_ID=pacific-1
GENESIS_URL=https://raw.githubusercontent.com/sei-protocol/testnet/main/pacific-1/genesis.json
MONIKER="your_node_name"
```

1. Clone the repository and install:
2. Clone the repository and install:

```bash
cd ~/ && git clone https://github.com/sei-protocol/sei-chain.git
cd sei-chain
git checkout $VERSION
make install
```
```bash
cd ~/ && git clone https://github.com/sei-protocol/sei-chain.git
cd sei-chain
git checkout $VERSION
make install
```

#### Initialize Node
### Initialize Node

1. Initialize the node:

```bash
seid init $MONIKER --chain-id $CHAIN_ID
```
```bash
seid init $MONIKER --chain-id $CHAIN_ID
```

2. Download and place genesis file:

```bash
wget -O genesis.json $GENESIS_URL
mv genesis.json ~/.sei/config
```

<div className="callout custom-green">
For light-client setup stop here, and add an RPC connection to `client.toml` as a final step.
</div>

#### Configure Node

1. Set persistent peers:

```bash
sed -i '/^# Comma separated list of nodes to keep persistent connections to$/,/^$/ s/^persistent-peers = ""$/persistent-peers = "[email protected]:26656,[email protected]:26656"/' ~/.sei/config/config.toml
```

2. Enable `sei-db`:

```bash
sed -i 's/^sc-enable = false/sc-enable = true/' ~/.sei/config/app.toml
```

### Create Systemd Service

1. Create the service file:

```bash
nano /etc/systemd/system/seid.service
```

2. Add the following content:

```ini
[Unit]
Description="Sei Daemon"
After=network-online.target

[Service]
User=<USER>
ExecStart=/home/<USER>/go/bin/seid start
Restart=always
RestartSec=3
LimitNOFILE=8192

[Install]
WantedBy=multi-user.target
```

### Use State Sync to Bootstrap Node
```bash
wget -O $HOME/.sei/config/genesis.json $GENESIS_URL
```

To rapidly sync with the network without using snapshots, use state sync with the provided script. This will automatically configure trusted block height and hash.
### Configure Node

1. Download the `state_sync` script from the Sei chain repository:
1. Enable `sei-db`:

```bash
mkdir -p ~/sei-chain/scripts
wget -O ~/sei-chain/scripts/state_sync.sh https://raw.githubusercontent.com/sei-protocol/sei-chain/refs/heads/main/scripts/state_sync.sh
chmod +x ~/sei-chain/scripts/state_sync.sh
```
```bash
sed -i 's/^sc-enable[[:space:]]*=.*$/sc-enable = true/; s/^ss-enable[[:space:]]*=.*$/ss-enable = true/' $HOME/.sei/config/app.toml
```

2. Run the state sync script:

```bash
~/sei-chain/scripts/state_sync.sh https://rpc.sei-apis.com
```
```bash
chmod +x $HOME/sei-chain/scripts/state_sync.sh
$HOME/sei-chain/scripts/state_sync.sh
```

This script will configure state sync settings in `config.toml` by:
- Setting the `trust_height` and `trust_hash` values to a recent block.
- Updating `rpc-servers` with the specified RPC URL.
3. Create Systemd Service File:

3. Start the node with the following command:
```bash
sudo tee /etc/systemd/system/seid.service > /dev/null << EOF
[Unit]
Description=Sei Daemon
After=network-online.target
[Service]
User=$USER
ExecStart=$(which seid) start
Restart=always
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
```

```bash
systemctl start seid
systemctl status seid
```
4. Start the node:

4. Verify that the state sync is progressing by checking logs:
```bash
sudo systemctl daemon-reload
sudo systemctl enable seid
sudo systemctl start seid
```

```bash
journalctl -fu seid -ocat
```
5. Verify that the state sync is progressing:

5. If successful, your node should reach full sync quickly.
```bash
sudo journalctl -u seid -f -o cat
```

## Appendix

### Node Types

- **RPC / Full Nodes:** Used for querying data or interacting with the chain. Default settings run RPC / full nodes.
- **Archive Nodes:** Maintain full state from genesis. Set `min-retain-blocks=0` and `pruning="nothing"` in `app.toml`.
- **State Sync Nodes:** Rapidly bootstrap new nodes by syncing with other nodes. State sync server configuration is managed in `app.toml`.
- **Validator Nodes:** Secure the chain by proposing and signing blocks. Set `mode=validator` in `config.toml`.

#### Default Service Ports
### Default Service Ports

The standard service ports can be manually configured in `$HOME/.sei/config/config.toml` and `$HOME/.sei/config/app.toml`:
The standard service ports can be configured in `$HOME/.sei/config/config.toml` and `$HOME/.sei/config/app.toml`:

- `26656`: P2P
- `26657`: RPC
- `1317`: REST
- `9090` : GRPC
- `8545`: EVM RPC
- `8546`: EVM Websocket
- `26660`: Tendermint Prometheus Metrics Exporter
- P2P: 26656
- RPC: 26657
- REST: 1317
- GRPC: 9090
- EVM RPC: 8545
- EVM Websocket: 8546
- Tendermint Prometheus Metrics Exporter: 26660

<Callout type="info" emoji="📘">
The standard websocket rides on the same connection as the RPC server. Example: [non-TLS] `ws://localhost:26657/websocket`.
</Callout>
The standard websocket uses the same connection as the RPC server. Example: `ws://localhost:26657/websocket` (non-TLS).

0 comments on commit 0d085ce

Please sign in to comment.