Setup Cardano Node via Docker Official Cardano Node Image

Question: Am I understanding what to do correctly to create a Cardano stake pool using docker? (Plus more questions below context highlighted in bold and italics)

My hope is that my detailed documentation of my journey here might help someone else like myself get a Cardano stake pool up and running with docker.

Background:

This is my first time trying to create a Cardano pool. That said, I am fairly skilled with Docker having used it and docker compose to make websites many times over and fairly skilled with shell scripting.

I have also read the ‘basics’ ((Re)introduction to Cardano | Cardano Developer Portal) and feel I have a grasp of how the network selects slot leaders, what the VRF is and the importance of the KES (and why it needs to renew). They had some great articles and videos there to help me understand. I understand how powerful Cardano is as a proof of stake network versus other protocols and want to be involved more than ever!

I also understand the server setup I will need (Understanding the Relay and Block Producer topology | Cardano Developer Portal) and what is involved with the key pairs (Cardano Key Pairs | Cardano Developer Portal)

The link to the official docker image is here: Docker

I prefer to use docker so I can copy my setup easily for future relay and block producer nodes so I don’t have to keep compiling from source every single time.

I also want to use something like Prometheus/Grafana later for monitoring the nodes and letting me know when I need to renew my KES (Key evolving signature). Reference Link: Grafana Dashboard Tutorial | Cardano Developer Portal

This background in mind:


If I understand correctly the docker image can help me bypass the build from source steps as linked here: (Cardano Node Installation process (Environment Setup) | Cardano Developer Portal)

From the documentation on the docker repo: I need to create a configuration directory and volume it into the docker image.

This makes sense since, a block producer node is almost the same thing as the relay just configured differently. So this will be how I can configure the nodes. (If I understand that correctly?)

The structure it says I need is this:

configuration/
├── configuration.yaml
├── genesis.json
└── topology.json

This is fine, but I’m not sure where I get the genesis.json or configuration.yaml files from. I’m somewhat familiar with topology.json from some tutorials I read on CoinCashew.

For example:

I’m planning to purchase 3 servers on DigitalOcean preinstalled with docker to run my Cardano stake pool nodes.

2 for relays and 1 for the block producer node. I plan to run Prometheus/Grafana on one of the relay servers (ideally as another docker image with access to the relay). I am not sure how to pull this off yet…, but this will be the goal. I’m aware that some setups will use a completely different server for the monitoring node, but I prefer to save on money starting out and just use the relay if possible.

An example topology file might look like this (taken from Cardano Relay Configuration (Startup scripts, Systemd) | Cardano Developer Portal):

{
  "LocalRoots": {
    "groups": [
      {
        "localRoots": {
          "accessPoints": [
            { "address": "your-blockproducer-address", "port": 6000 }
          ],
          "advertise": false
        },
        "valency": 1
      }
    ]
  },
  "PublicRoots": [
    {
      "publicRoots": {
        "accessPoints": [
          {
            "address": "preprod-node.world.dev.cardano.org",
            "port": 30000
          }
        ],
        "advertise": false
      }
    }
  ],
  "useLedgerAfterSlot": 4642000
}

What is not clear about this is what some of these options mean. What is LocalRoots?

What is PublicRoots?

I’m going to assume that I just put the IP Address of the block producer node in your-blockproducer-address. I’m not sure how this file should look for a block producer node?

I was reading another tutorial from coinCashew and the way they describe the topology.json file was quite different from this, which is why I was having some confusion.

The section I read in the tutorial is here: Configuring Stake Pool Topology - CoinCashew

The relay node configuration for topology.json is:

{
	"Producers": [
	  {
	    "addr": "<BlockProducingNodeIPAddress>",
	    "port": 6000,
	    "valency": 1
	  },
	  {
	    "addr": "relays-new.cardano-mainnet.iohk.io",
	    "port": 3001,
	    "valency": 2
	  }
	]
}

This makes a lot of sense to me, since this tells the relay which node is the producer. The example on cardano’s website however looks completely different! (which makes me wonder if the tutorial is outdated?)

According to that same tutorial the configuration I would use for the block producing node would be this:

{
	"Producers": [
	  {
	    "addr": "<RelayNodeIPAddress>",
	    "port": 6000,
	    "valency": 1
	  }
	]
}

This also makes a lot of sense, I just supply an array of relay node ip addresses and ports. My hope is it still works this way but I’m not sure?

Assuming I get to the point this is all setup, I will need to install gLiveView or something similar like proposed in the tutorial (Starting the Nodes - CoinCashew)

How can I set up Grafana/Prometheus/gLiveView with docker?


Assuming I get past those steps, my understanding is I have to use the nodes to create the keys I will need.

For example on this page (Registering a Stake Address | Cardano Developer Portal) it mentions using cardano-cli. I’m assuming this is what is built on the docker image I can call all those commands like follows:

docker run -v $PWD/configuration/defaults/byron-mainnet:/configuration \
     inputoutput/cardano-node run \
      --config /configuration/configuration.yaml \
      --topology /configuration/topology.json \
      --database-path /db

Where if i was running that command the assumption would be that I have volumed in topology.json in the configuration folder correctly. I’m wondering if the database-path should also be volumed in? (Since if the docker image goes down, would it not have to redownload it all over again since it’s only in memory of the image at that point).

In the example of running the docker command I gave, it would be given that $PWD/configuration/defaults/byron-mainnet would be where I’m storing my configuration files on the node server so that the docker container can find and volume it into the containers internal location /configuration, hence why the cardano-node command I can simply refer to files with /configuration from henceforth after. It does this due to the mapping : character with the -v option given from docker run (which stands for volume), which takes a local path and creates the relationship between the local computer and the docker container. Am I understanding this correctly?

If this is the case, then I assume to create the keys I will need to run commands against the node in a similar fasion.

For example:

This tutorial states I should do the following:

mkdir -p $HOME/cardano-testnet/keys
cd $HOME/cardano-testnet/keys

I could create these on an air gapped machine (for security) running the docker container and give access to these volumes to the container?

From there the next sample command was:

cardano-cli address key-gen \
    --verification-key-file ./keys/payment.vkey \
    --signing-key-file ./keys/payment.skey

To make this work, since it’s expecting a path in the container at ./keys/ I would probably need to make sure that I volume in another path for these keys that will be created and map it to the /keys directory of the container.

Something like this? docker run -v $PWD/keys/:/keys inputoutput/cardano-cli address key-gen \ --verification-key-file ./keys/payment.vkey \ --signing-key-file ./keys/payment.skey

Assuming this is good, I can do the rest of the steps using cardano-cli in a similar manner.

Am I on the right track with this?

1 Like

You can download conway genesis and config files from:

https://book.world.dev.cardano.org/environments.html

The Armada Alliance has a tutorial for Docker (on ARM)

1 Like

@token I am going through this now and will post any questions I have.

1 Like

What wallet can I use to test the ‘testnet’, I noticed daedalus does not have a testnet download?

I found a wallet called nami that I was able to receive test faucet funding from (https://docs.cardano.org/cardano-testnet/tools/faucet/), I also got the docker relay node working so far :slight_smile:

Screenshot 2023-08-12 at 3.18.43 PM

Screenshot 2023-08-12 at 3.20.48 PM

Now I just need to figure out how to create the block producing node instead of the relay, which was unclear on their tutorial because you need to create a pool first I believe, and it doesn’t talk about how to generate the keys I’m sure I need (but it doesn’t cover that), link here to the tutorial, refer to very bottom part about the block producing node (Cardano Node Docker Image for ARM64 devices 🐳 | Armada Alliance Docs)

As for understanding the new topology files I found a nice youtube video here on it (https://www.youtube.com/watch?v=hOFVL6gjFrw&ab_channel=IOGAcademy), very helpful for understanding this for anyone else.

1 Like

Great. The block producer is a node, just like the relay.

Differences:

block producer topology (should list only your relay)

You must register your pool and add the keys and certificate (the script running the node must reference these keys to run as bp)

kes.skey
node.cert
vrf.skey

Guides:

On Ubuntu (x86)

Asahi on arm-based Mac Mini M1 (aarch64)

1 Like