# Installing SPOS scripts

{% hint style="warning" %}
Install these scripts on a **secure, offline workstation** — not on your online relay or BP server. The keys generated here control your wallets and stake pool. Anyone with access to these keys has full control over your funds and pool.
{% endhint %}

{% hint style="info" %}
SPOS supports air-gapped (offline) key generation and hardware wallets (Trezor/Ledger) for maximum security.
{% endhint %}

## 1) Install dependencies

```bash
sudo apt update -y
sudo apt install -y curl bc jq
```

## 2) Clone the SPOS repository

```bash
cd ~
mkdir -p git && cd git
rm -rf scripts
git clone https://github.com/gitmachtl/scripts
cd scripts
ls -al
```

<figure><img src="https://2741608310-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUuyIBhqHgBAmQaDXz0PX%2Fuploads%2Fgit-blob-8381dac71547df4f68c8c4cc46ff69f9a70b1991%2Fterminal-spos-ls.png?alt=media" alt="SPOS scripts directory listing"><figcaption></figcaption></figure>

## 3) Copy scripts to your PATH

{% tabs %}
{% tab title="Mainnet" %}

```bash
cp cardano/mainnet/* ~/.local/bin/
```

{% endtab %}

{% tab title="Testnet (pre-prod)" %}

```bash
cp cardano/testnet/* ~/.local/bin/
```

{% endtab %}
{% endtabs %}

## 4) Create the SPOS configuration file

This tells the scripts where to find the node socket and genesis files. Placing it in your home directory means you do not need to reconfigure when upgrading scripts.

{% tabs %}
{% tab title="Mainnet" %}

```bash
cat <<EOF > ~/.common.inc
socket="/home/cardano/cnode/sockets/node.socket"

genesisfile="/home/cardano/cnode/config/shelley-genesis.json"
genesisfile_byron="/home/cardano/cnode/config/byron-genesis.json"

cardanocli="cardano-cli"
cardanonode="cardano-node"

magicparam="--mainnet"
addrformat="--mainnet"

byronToShelleyEpochs=208
EOF
```

{% endtab %}

{% tab title="Testnet (pre-prod)" %}

```bash
cat <<EOF > ~/.common.inc
socket="/home/cardano/cnode/sockets/node.socket"

genesisfile="/home/cardano/cnode/config/shelley-genesis.json"
genesisfile_byron="/home/cardano/cnode/config/byron-genesis.json"

cardanocli="cardano-cli"
cardanonode="cardano-node"

magicparam="--testnet-magic 1"
addrformat="--testnet-magic 1"

byronToShelleyEpochs=4
EOF
```

{% endtab %}
{% endtabs %}

## 5) Verify installation

```bash
00_common.sh
```

<figure><img src="https://2741608310-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUuyIBhqHgBAmQaDXz0PX%2Fuploads%2Fgit-blob-d40db346e3f5e1ae61920b6e823c2ba7d0558003%2Fterminal-spos-common.png?alt=media" alt="00_common.sh showing cli 10.15.0.0 / node 10.6.2"><figcaption></figcaption></figure>

The output shows the detected `cardano-cli` and `cardano-node` versions, the operating mode, and the configured network.

{% hint style="info" %}
The "Warning: Node-Socket does not exist" message is expected if the node is not running on this machine (e.g., on an offline workstation).
{% 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://cardano-node-installation.stakepool247.eu/cardano-block-producer-configuration/stakepool-operator-scripts-spos.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.
