# Node Installation

## [TELEMETRY](https://telemetry.polkadot.io/#list/0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3)

* **Hardware requirements**:

| Node Type | CPU | RAM  | Storage |
| --------- | --- | ---- | ------- |
| Mainnet   | 8   | 32GB | 2TB     |

#### 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
```

## Docker and docker-compose

```bash
. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/installers/docker.sh)
```

## Build 24.02.25

```bash
cd $HOME
mkdir -p $HOME/.polkadot
chown -R $(id -u):$(id -g) $HOME/.polkadot

#Start
docker run -dit \
--name polkadot_node \
--restart always \
--network host \
-v $HOME/.polkadot:/data -u $(id -u ${USER}):$(id -g ${USER}) \
parity/polkadot:latest --base-path /data \
--validator --name "<moniker>" \
--port 30333 \
--rpc-port 9933 \
--prometheus-port 9615 \
--telemetry-url 'wss://telemetry.polkadot.io/submit/ 1' \
--telemetry-url 'wss://telemetry-backend.w3f.community/submit 1'
```

* After launch, we wait for our node to synchronize. You can track our condition using telemetry

## [TELEMETRY](https://telemetry.polkadot.io/#list/0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3)

* After the node has synchronized, we pull out the key from our node by entering the command

```python
curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys", "params":[]}' http://localhost:9933
```

### Creating a validator

* Go to the [chain](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fpolkadot-public-rpc.blockops.network%2Fws#/accounts) and first create a wallet
* We create a validator. To do this, select `Network - Staking - Accounts - Validator`

## SnapShot Mainnet | RocksDB (pruned) - updated every 24 hours <a href="#snapshot-mainnet-updated-every-5-hours" id="snapshot-mainnet-updated-every-5-hours"></a>

{% hint style="success" %}
[`https://polkadot-snapshot.stavr.tech/`](https://polkadot-snapshot.stavr.tech/)
{% endhint %}

```bash
cd $HOME
apt install lz4
docker stop polkadot_node
rm -rf $HOME/.polkadot/chains/polkadot/db
curl -o - -L https://polkadot.snapshot.stavr.tech/polkadot-snap.tar.lz4 | lz4 -c -d - | tar -x -C $HOME/.polkadot/chains/polkadot/
docker restart polkadot_node && docker logs polkadot_node -fn 100
```

## SnapShot Mainnet | RocksDB (Archive) - updated every 7 days <a href="#snapshot-mainnet-updated-every-5-hours" id="snapshot-mainnet-updated-every-5-hours"></a>

{% hint style="success" %}
[`https://polkadot-snapshot.stavr.tech/`](https://polkadot-snapshot.stavr.tech/)
{% endhint %}

```bash
cd $HOME
apt install lz4
docker stop polkadot_node
rm -rf $HOME/.polkadot/chains/polkadot/db
curl -o - -L https://polkadot-archive.snapshot.stavr.tech/polkadot-archive-snap.tar.lz4 | lz4 -c -d - | tar -x -C $HOME/.polkadot/chains/polkadot/
docker restart polkadot_node && docker logs polkadot_node -fn 100
```

## [🧩Services and Tools🧩](https://stavr-team.gitbook.io/nodes-guides/mainnets/polkadot/snapshot)

## 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)

`logs`

```python
docker logs polkadot_node -fn 100
```

`restart`

```
docker restart polkadot_node
```

`delete node`

```bash
docker stop polkadot_node
docker rm polkadot_node
rm -rf $HOME/.polkadot
docker system prune -af --volumes
```
