# Node Installation

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

* **Minimum hardware requirements**:

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

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

```python
mkdir -p $HOME/.tangle && cd $HOME/.tangle
wget -O tangle https://github.com/tangle-network/tangle/releases/download/v1.4.0/tangle-default-linux-amd64
chmod 744 tangle
mv tangle /usr/bin/
wget -O $HOME/.tangle/tangle-mainnet.json "https://raw.githubusercontent.com/webb-tools/tangle/main/chainspecs/mainnet/tangle-mainnet.json"
chmod 744 ~/.tangle/tangle-mainnet.json
# Проверим json
sha256sum ~/.tangle/tangle-mainnet.json
# b640e7fb959066ce29a3ddece42f17cc4e76b4383fd57e4f4249e2c80bff8a00
```

`tangle --version`

* tangle 1.4.0-06942006848

### Creating Keys

`Acco`

```bash
tangle key insert --base-path $HOME/.tangle/data/ \
--chain $HOME/.tangle/tangle-mainnet.json \
--scheme Sr25519 \
--suri "<SEED_PHRASE-12>" \
--key-type acco
```

`Babe`

```python
tangle key insert --base-path $HOME/.tangle/data/ \
--chain $HOME/.tangle/tangle-mainnet.json \
--scheme Sr25519 \
--suri "<SEED_PHRASE-12>" \
--key-type babe
```

`Imonline`

```python
tangle key insert --base-path $HOME/.tangle/data/ \
--chain $HOME/.tangle/tangle-mainnet.json \
--scheme Sr25519 \
--suri "<SEED_PHRASE-12>" \
--key-type imon
```

`Role`

```python
tangle key insert --base-path $HOME/.tangle/data/ \
--chain $HOME/.tangle/tangle-mainnet.json \
--scheme Ecdsa \
--suri "<SEED_PHRASE-12>" \
--key-type role
```

`Grandpa`

```python
tangle key insert --base-path $HOME/.tangle/data/ \
--chain $HOME/.tangle/tangle-mainnet.json \
--scheme Ed25519 \
--suri "<SEED_PHRASE-12>" \
--key-type gran
```

`ls $HOME/.tangle/data/chains/tangle-mainnet/keystore/`

## Create a service file

```python
yourname=<name>
```

```python
tee /etc/systemd/system/tangle.service > /dev/null << EOF
[Unit]
Description=Tangle Validator Node
After=network-online.target
StartLimitIntervalSec=0
[Service]
User=$USER
Restart=always
RestartSec=3
LimitNOFILE=65535
ExecStart=/usr/bin/tangle \
  --base-path $HOME/.tangle/data/ \
  --name '$yourname' \
  --chain $HOME/.tangle/tangle-mainnet.json \
  --node-key-file "$HOME/.tangle/node-key" \
  --port 30333 \
  --rpc-port 9933 \
  --prometheus-port 9515 \
  --validator \
  --pruning archive \
  --telemetry-url "wss://telemetry.polkadot.io/submit/ 1"
  --no-mdns
[Install]
WantedBy=multi-user.target
EOF
```

### Start

```python
systemctl daemon-reload
systemctl enable tangle
systemctl restart tangle && journalctl -fu tangle -o cat
```

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

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

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

### BACKUP

🟢 save the located keys in `$HOME/.tangle/node-key` and `$HOME/.tangle/data/validator/YOURNAME/chains/tangle-testnet/keystore/`

### Creating a validator

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

`logs`

```bash
journalctl -fu tangle -o cat
```

`restart`

```bash
systemctl restart tangle && journalctl -fu tangle -o cat
```

`delete node`

```bash
systemctl stop tangle &&
systemctl disable tangle &&
rm /etc/systemd/system/tangle.service &&
systemctl daemon-reload &&
cd
rm -r .tangle
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://stavr-team.gitbook.io/nodes-guides/mainnets/tangle/node-installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
