# Installation

1. **Update packages and install useful tools.**

```
sudo apt update && sudo apt upgrade --yes && \
sudo apt install git build-essential ufw curl jq snapd screen ncdu nano fuse ufw --yes
```

2. **Install `go` using `snap`**.

```
sudo snap install go --classic && \
echo 'export GOPATH="$HOME/go"' >> ~/.profile && \
echo 'export GOBIN="$GOPATH/bin"' >> ~/.profile && \
echo 'export PATH="$GOBIN:$PATH"' >> ~/.profile && \
source ~/.profile && \
go version
```

3. **Build the binary from source.**

```
git clone https://github.com/desmos-labs/desmos
cd desmos
git checkout v7.1.1
make install
desmos version
```

4. **Initialize your node.**

```
desmos init <node_name> --chain-id=desmos-mainnet
```

5. **Download genesis.**

```
curl https://raw.githubusercontent.com/desmos-labs/mainnet/main/genesis.json > ~/.desmos/config/genesis.json
```

6. **Add persistent peers to `config.toml`.**

```
peers="bdd98ec74fe56146f08e886239e52373f6821ce3@95.216.148.253:26656,7ea74a6fd693c8a04fb11d3e31f231c2c949db5c@157.90.230.83:26656,86451fccaa2745dba3c5e88f289cb8a7fccda107@139.162.131.107:26656,af4e9b5cc3509893877e82bf1de1d6316fe0bb1c@152.228.216.224:26656,c880aded1fd96647e85bd301c18dafb6ae7dd3a8@5.9.121.55:41856"
sed -i.bak -e  "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" ~/.desmos/config/config.toml
```

7. **Set up pruning (optional).**

```
PRUNING="custom"
PRUNING_KEEP_RECENT="100"
PRUNING_INTERVAL="10"

sed -i -e "s/^pruning *=.*/pruning = \"$PRUNING\"/" $HOME/.desmos/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \
\"$PRUNING_KEEP_RECENT\"/" $HOME/.desmos/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \
\"$PRUNING_INTERVAL\"/" $HOME/.desmos/config/app.toml
```

9. **Create service file.**

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

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

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

10. **Enable and start service.**

```
systemctl daemon-reload
systemctl enable desmosd
systemctl restart desmosd
journalctl -u desmosd -f -o cat
```

{% hint style="info" %}
If you would like to speed up the sync process, you may try using State Sync.
{% endhint %}


---

# 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://services.stakeangle.com/mainnets/desmos/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.
