First mononode Stake Pool using CNTools

Hello,
I’m trying to configure my first stake pool using cntools and i want to configure a mononode with Producer and Relay.

I have a cloud instance machine with this configuration:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet MYPUBLICIP netmask 255.255.240.0 broadcast MYBROADCAST

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.110.0.2 netmask 255.255.240.0 broadcast 10.110.15.255

netstat -an | grep -i list
tcp 0 0 127.0.0.1:12788 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:2517 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:12798 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN
tcp6 0 0 :::2517 :::* LISTEN

  • I put in “env” file “CNODE_PORT=6001”
  • I have to edit “topologyUpdater.sh” for relay:
    CUSTOM_PEER = “producer ip:port|relays-new.cardano-mainnet.iohk.io:3001:2”
  1. what ip and port should i put in?
  • I have to edit topology.json for Producer, so I put:

{
“Producers”: [
{
“addr”: “MYPUBLICIP”,
“port”: 6001,
“valency”: 1
},

  1. Is that right or better to use internal or 127.0.0.1 IP?
  • I have to run ./deploy-as-systemd.sh that is configuring for me cnode.service
  1. should I put “YES” to topology updater? this is needed for relays and i want to run both in a single machine… should I make a difference between processes configuring 2 separate services? What do you think?

Thank you very much!!!

1 Like

Hi There!

I am not familiar with cntools - what is the listen port of your producer node? if the default one, which is 3001 then the CUSTOM_PEER should be this:

CUSTOM_PEER="127.0.0.1:3001|relays-new.cardano-mainnet.iohk.io:3001:2"

yes, you can use 127.0.0.1 as MYPUBLICIP in the producer toplogy file, since the relay node listens on all interfaces - tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 0.0.0.0 means that listens on all interfaces, like on the loopback interface.
yes, use YES for the topology updater

1 Like

Hi, thank you very much for your answer!
I’m very confused about producer listener port:

In netstat I show you I have:

  1. tcp 0 0 127.0.0.1:12788 0.0.0.0:* LISTEN -----> ???
  2. tcp 0 0 0.0.0.0:2517 0.0.0.0:* LISTEN ---------- SERVICE I KNOW, SERVER USED PORT
  3. tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN -----------> Maybe a DNS I dont KNOW
  4. tcp 0 0 127.0.0.1:12798 0.0.0.0:* LISTEN -----------> ???
  5. tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN ---------------> PORT I put in “env” file “CNODE_PORT=6001” (RELAY ???)
  6. tcp6 0 0 :::2517 :::* LISTEN -------------------> SERVICE I KNOW, SERVER USED PORT

IF I ask for the service status I get:

sudo systemctl status cnode.service
● cnode.service - Cardano Node
Loaded: loaded (/etc/systemd/system/cnode.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2021-03-21 10:24:09 UTC; 4h 19min ago
Main PID: 236532 (cnode.sh)
Tasks: 17 (limit: 4683)
Memory: 3.4G
CGroup: /system.slice/cnode.service
├─236532 /bin/bash /opt/cardano/cnode/scripts/cnode.sh
└─236645 cardano-node run --topology /opt/cardano/cnode/files/topology.json --config /opt/cardano/cnode/files/config.json --database-path /opt/cardano/cno>

Mar 21 10:24:09 iscsp-node01 systemd[1]: Started Cardano Node.
Mar 21 10:24:10 iscsp-node01 cnode[236532]: WARN: A prior running Cardano node was not cleanly shutdown, socket file still exists. Cleaning up.
Mar 21 10:24:12 iscsp-node01 cnode[236645]: Listening on http://127.0.0.1:12798

So 12798 should be Producer port?
Where can I find this value?

And another question: how I can verify if Relay is connecting regularly with producer and if all is working properly?

Thank you very much for your answers! They are gold for me!

use sudo netstat -noptla to get the process name, I think producer not started yet…

That’s the output:

sudo netstat -noptla | grep -i list
tcp 0 0 127.0.0.1:12788 0.0.0.0:* LISTEN 240443/cardano-node off (0.00/0/0)
tcp 0 0 0.0.0.0:2517 0.0.0.0:* LISTEN ************************ (0.00/0/0)
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 532/systemd-resolve off (0.00/0/0)
tcp 0 0 127.0.0.1:12798 0.0.0.0:* LISTEN 240443/cardano-node off (0.00/0/0)
tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 240443/cardano-node off (0.00/0/0)
tcp6 0 0 :::2517 :::* LISTEN ********************** (0.00/0/0)

Thank you very much!

Hei!

those are monitoring ports - prometheus and EKG… these port definitions can be found in /opt/cardano/cnode/files/config.json
So the producer not started yet - how did you started the producer pool? do you have all the keys certs generated for producer node?
so you need separate services for each node - is there any option to generate the service file for the producer node?

U have a script called gLiveView.sh inside scripts folder

U can run it and u should see peers 1/1 (if u have only one relay) …more if u press p u will see more details like IP and port of the remote peer

Cheers,

Hi,
I followed this istructions and I read that, also if not best pratice, I can configure Producer and Relay on the same server:

Creating non-root user:

sudo adduser node
sudo adduser node sudo
sudo su - node
mkdir ~/.ssh
cd .ssh
nano ~/.ssh/authorized_keys

disable root login/Set new SSH Port:

sudo nano /etc/ssh/sshd_config
sudo systemctl restart ssh
sudo systemctl status ssh

Update Ubuntu:

sudo apt-get update
sudo apt-get upgrade

Creating firewall:

relay nodes:

ufw default deny incoming
ufw default allow outgoing
ufw limit proto tcp from any to any port [custom ssh port]
ufw allow [relay port]/tcp

producer node:

ufw default deny incoming
ufw default allow outgoing
ufw limit proto tcp from any to any port [custom ssh port]
sudo ufw allow from [relay 1 ip] to any port [producer port] proto tcp
sudo ufw allow from [relay 2 ip] to any port [producer port] proto tcp

Installing Prereqs:

mkdir “$HOME/tmp”
cd “HOME/tmp" curl -sS -o prereqs.sh https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/prereqs.sh chmod 755 prereqs.sh ./prereqs.sh -f . "{HOME}/.bashrc”

Installing cardano-node and cardano-cli:

cd ~/git
git clone GitHub - input-output-hk/cardano-node: The core component that is used to participate in a Cardano decentralised blockchain.
cd cardano-node
git fetch --tags --all
git pull
git checkout $(curl -s https://api.github.com/repos/input-output-hk/cardano-node/releases/latest | jq -r .tag_name)
$CNODE_HOME/scripts/cabal-build-all.sh -o
[cardano-cli version]
[cardano-node version]

configuring env and starting node:

cd $CNODE_HOME/scripts
nano env
CNODE_PORT=[PORT]
POOL_NAME=[NAME]

./deploy-as-systemd.sh
sudo systemctl start cnode.service
sudo systemctl status cnode.service
./sLiveView

Editing topologyUpdater.sh for relays:

CUSTOM_PEER = “producer ip:port|relays-new.cardano-mainnet.iohk.io:3001:2”
sudo systemctl restart cnode.service

Editing topology.json for Producer:

{
“Producers”: [
{
“addr”: “relay ip”,
“port”: relay port,
“valency”: 1
},
{
“addr”: “other relay ip”,
“port”: other relay port,
“valency”: 1
}
]
}

Creating wallet/Registering pool:

./cntools.sh

The problem is that i would like run relay and producer on the same server

Ok, understand… but u have 2 users created on server, one for relay and one for producer?

Cheers,

./deploy-as-systemd.sh - this script starts only 1 node. do you have a link to the instructions you followed?

No, by now I have only one user maybe I have to use 2 different users… do you suggest it to me?

I think he installed everything for a single node… but now he want to start 2 nodes… which should be done in 2 separate intances of linux

1 Like

Exactly it’s what I have done

yes - so what is needed here a new folder for producer node and use cntools.sh inside that folder to get a new configs of producer node?

CNTOOLS is just a fancy application for signining transactions ( it has a friendly gui )… not for generating any configs

What is the hw configuration of the server? And u want to do this on your home desktop?

ok - no need to have 2 users - just create a new CNODE_HOME folder for the producer node and start again the process - new env file, and so on for the new node…

that is what I meant on cntools.sh

except you dont need to build the cardano-node and cli again… I forget to mention this… so basically you will start cardano-node twice with different ports and configs - systemctl can handle this - cnode.sh script will detect what type of node is in CNODE_HOME

1 Like