# The setup

{% hint style="info" %}
**This tutorial guides you through the process of creating a stake pool on the preview testnet (testnet-magic 2).**

**Make sure to use the appropriate genesis files from**: [**https://book.world.dev.cardano.org/environments.html**](https://book.world.dev.cardano.org/environments.html).\
\
**For pre-production testnet, just replace `--testnet-magic 2` with `--testnet-magic 1`.**

**For mainnet, use `--mainnet`**
{% endhint %}

A stake pool requires several key components:

* **Cold keys**: used for registering a stake pool, controlling stake pool parameters, issuing operational certificates, and retiring a stake pool
* **VRF keys**: play a crucial role in the slot leader election process and contribute to the evolving nonce
* **Operational keys**, also known as **KES key**s: used in conjunction with operational certificates to sign blocks
* **Operational certificate:** facilitates the transfer of stake rights from cold keys to KES keys and is included in the block header
* **Operational certificate counter:** to determine precedence, a certificate with a higher counter takes precedence over one with a lower counter

When operating a stake pool, there should be a core node responsible for block production and at least one relay node responsible for block propagation. Ideally, multiple relays are advisable to ensure continuous block broadcasting, even in the event of a relay or its connections failing. Each node should run on a separate machine.

The **block-producing** node holds the KES signing key, the VRF signing key, and the operational certificate. **Relay** nodes do not need any keys.

Additionally, an air-gapped machine is essential, especially when running a pool on mainnet. It ensures the security of cold keys and wallet keys by keeping them isolated from the internet, preventing any exposure.

The **block producer** must be well secured and **only** connect to its own relay nodes.

**Relay nodes** should connect to their own block producer and to 15-20 other relays on the network.

P2P ensures duplex connections, whereas employing a classic topology demands that other relays include your relays in their topology. This may necessitate agreements with other stake pool operators.

<figure><img src="/files/I5EnYQ9REPQSqqguFbyG" alt=""><figcaption></figcaption></figure>


---

# 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-course.gitbook.io/cardano-course/handbook/create-a-stake-pool/the-setup.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.
