# Node Installation

## [EXPLORER](https://explorer.stavr.tech/Xrpl-Testnet/staking)

* **Minimum hardware requirements**:

| Node Type | CPU | RAM | Storage |
| --------- | --- | --- | ------- |
| Testnet   | 4   | 8GB | 150GB   |

## 1) Auto\_install script

```bash
source <(curl -s https://raw.githubusercontent.com/111STAVR111/props/refs/heads/main/Xrpl/xrplt)
```

## 2) Manual installation

#### Preparing the server

```bash
sudo apt update && sudo apt upgrade -y
sudo apt install curl tar wget clang pkg-config libssl-dev jq build-essential bsdmainutils git make ncdu gcc git jq chrony liblz4-tool -y
```

### GO 1.21.6

```bash
ver="1.21.6"
wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz"
rm "go$ver.linux-amd64.tar.gz"
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
source $HOME/.bash_profile
go version
```

## Build 26.05.25

```bash
cd $HOME && mkdir -p go/bin/
git clone https://github.com/xrplevm/node.git xrplevm
cd xrplevm
git checkout v8.0.0
make install
```

`exrpd version --long | grep -e version -e commit`

* version: 8.0.0
* commit: 8d92d087b9a1014de748b8887868e0e90b97b56f

## Initiation

```python
exrpd init STAVR_guide --chain-id xrplevm_1449000-1
```

### Create/recover wallet

```bash
exrpd keys add <walletname>
           OR
exrpd keys add <walletname> --recover
```

### Download Addrbook and Genesis

```python
wget -O $HOME/.exrpd/config/addrbook.json "https://server-1.stavr.tech/Testnet/Xrpl/addrbook.json"
wget -O $HOME/.exrpd/config/genesis.json "https://server-1.stavr.tech/Testnet/Xrpl/genesis.json"
```

`sha256sum $HOME/.exrpd/config/genesis.json`

* 05f53e64b51bd1cd79ee598e9c76b0ce47e47b9ddff7311fcbd2b8f479d36a25

### Set up the minimum gas price and Peers/Seeds/Filter peers/MaxPeers

```bash
sed -i.bak -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0axrp\"/;" ~/.exrpd/config/app.toml
external_address=$(wget -qO- eth0.me) 
sed -i.bak -e "s/^external_address *=.*/external_address = \"$external_address:26656\"/" $HOME/.exrpd/config/config.toml
peers=""
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.exrpd/config/config.toml
seeds=""
sed -i.bak -e "s/^seeds =.*/seeds = \"$seeds\"/" $HOME/.exrpd/config/config.toml
sed -i 's/max_num_inbound_peers =.*/max_num_inbound_peers = 50/g' $HOME/.exrpd/config/config.toml
sed -i 's/max_num_outbound_peers =.*/max_num_outbound_peers = 50/g' $HOME/.exrpd/config/config.toml
```

#### Pruning (optional)

```bash
pruning="custom"
pruning_keep_recent="1000"
pruning_keep_every="0"
pruning_interval="10"
sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.exrpd/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.exrpd/config/app.toml
sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.exrpd/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.exrpd/config/app.toml
```

#### Indexer (optional)

```bash
indexer="null" &&
sed -i -e "s/^indexer *=.*/indexer = \"$indexer\"/" $HOME/.exrpd/config/config.toml
```

## Create a service file

```bash
sudo tee /etc/systemd/system/exrpd.service > /dev/null <<EOF
[Unit]
Description=exrpd
After=network-online.target

[Service]
User=$USER
ExecStart=$(which exrpd) start
Restart=on-failure
RestartSec=3
LimitNOFILE=65535

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

## StateSync XRPL Testnet

```bash
systemctl stop exrpd
SNAP_RPC=https://xrpl.rpc.t.stavr.tech:443
LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height); \
BLOCK_HEIGHT=$((LATEST_HEIGHT - 1000)); \
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)

echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH

sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"| ; \
s|^(seeds[[:space:]]+=[[:space:]]+).*$|\1\"\"|" $HOME/.exrpd/config/config.toml
exrpd tendermint unsafe-reset-all --home /root/.exrpd
wget -O $HOME/.exrpd/config/addrbook.json "https://server-1.stavr.tech/Testnet/Xrpl/addrbook.json"
sudo systemctl restart exrpd && journalctl -fu exrpd -n1000 -ocat
```

## SnapShot Testnet updated every 5 hours (Pruned)

{% hint style="success" %}
<https://server-1.stavr.tech/Testnet/Xrpl/>
{% endhint %}

```bash
cd $HOME
apt install lz4
sudo systemctl stop exrpd
cp $HOME/.exrpd/data/priv_validator_state.json $HOME/.exrpd/priv_validator_state.json.backup
rm -rf $HOME/.exrpd/data
LATEST_SNAPSHOT=$(curl -s https://server-1.stavr.tech/Testnet/Xrpl/ | grep -oE 'xrpl-snap-[0-9]+\.tar\.lz4' | while read SNAPSHOT; do HEIGHT=$(curl -s "https://server-1.stavr.tech/Testnet/Xrpl/${SNAPSHOT%.tar.lz4}-info.txt" | awk '/Block height:/ {print $3}'); echo "$SNAPSHOT $HEIGHT"; done | sort -k2 -nr | head -n 1 | awk '{print $1}')
curl -o - -L https://server-1.stavr.tech/Testnet/Xrpl/$LATEST_SNAPSHOT | lz4 -c -d - | tar -x -C $HOME/.exrpd
mv $HOME/.exrpd/priv_validator_state.json.backup $HOME/.exrpd/data/priv_validator_state.json
wget -O $HOME/.exrpd/config/addrbook.json "https://server-1.stavr.tech/Testnet/Xrpl/addrbook.json"
sudo systemctl restart exrpd && journalctl -fu exrpd -n1000 -ocat
```

## SnapShot Testnet updated every 3d (Archive)

{% hint style="success" %}
<https://server-3.stavr.tech/Testnet/>[Xrpl/](https://server-1.stavr.tech/Testnet/Xrpl/)
{% endhint %}

```bash
cd $HOME
apt install lz4
sudo systemctl stop exrpd
cp $HOME/.exrpd/data/priv_validator_state.json $HOME/.exrpd/priv_validator_state.json.backup
rm -rf $HOME/.exrpd/data
LATEST_SNAPSHOT=$(curl -s https://server-3.stavr.tech/Testnet/Xrpl/ | grep -oE 'xrpl-snap-[0-9]+\.tar\.lz4' | while read SNAPSHOT; do HEIGHT=$(curl -s "https://server-3.stavr.tech/Testnet/Xrpl/${SNAPSHOT%.tar.lz4}-info.txt" | awk '/Block height:/ {print $3}'); echo "$SNAPSHOT $HEIGHT"; done | sort -k2 -nr | head -n 1 | awk '{print $1}')
curl -o - -L https://server-3.stavr.tech/Testnet/Xrpl/$LATEST_SNAPSHOT | lz4 -c -d - | tar -x -C $HOME/.exrpd
mv $HOME/.exrpd/priv_validator_state.json.backup $HOME/.exrpd/data/priv_validator_state.json
wget -O $HOME/.exrpd/config/addrbook.json "https://server-1.stavr.tech/Testnet/Xrpl/addrbook.json"
sudo systemctl restart exrpd && journalctl -fu exrpd -n1000 -ocat
```

### Start

```bash
sudo systemctl daemon-reload
sudo systemctl enable exrpd
sudo systemctl restart exrpd && journalctl -fu exrpd -n1000 -ocat
```

#### Create validator

```python
#pubkey
exrpd tendermint show-validator --home $HOME/.exrpd
cd $HOME
nano $HOME/.exrpd/validator.json
{
  "pubkey": {"#pubkey"},
  "amount": "1000000000000000000axrp",
  "moniker": "STAVR_guide",
  "identity": "",
  "website": "",
  "security": "",
  "details": "",
  "commission-rate": "0.05",
  "commission-max-rate": "0.2",
  "commission-max-change-rate": "0.2",
  "min-self-delegation": "1"
}
exrpd --home $HOME/.exrpd tx staking create-validator $HOME/.exrpd/validator.json --from WalletName  --chain-id xrplevm_1449000-1 -y
```

## [🧩Services and Tools🧩](https://stavr-team.gitbook.io/nodes-guides/testnets/xrpl/sync)

## Monitoring

You can set up your node status alarm here - [Monitoring](https://stavr-team.gitbook.io/nodes-guides/monitoring)

## Security

You can create secure management of your wallet and your node by following this links.

[TMKMS](https://stavr-team.gitbook.io/nodes-guides/tmkms)               [Wallet Security](https://stavr-team.gitbook.io/nodes-guides/wallet-security)

### Delete node

```bash
sudo systemctl stop exrpd
sudo systemctl disable exrpd
rm /etc/systemd/system/exrpd.service
sudo systemctl daemon-reload
cd $HOME
rm -rf exrpd
rm -rf .exrpd
rm -rf $(which exrpd)
```
