You can install CNCLI using either the release binaries or compiling the Rust code. Both installation examples hereby illustrated are instructions for an Ubuntu Linux server and use standard system paths from the Linux File System Hierarchy Standard.
To install CNCLI from a binary release, download the latest release and extract it in the /usr/local/bin/
directory of the block producing node
server of your stake pool. Adjust the <latest_release_version>
variable in the command to the latest release available:
curl -sLJ https://github.com/AndrewWestberg/cncli/releases/download/v<latest_release_version>/cncli-<latest_release_version>-x86_64-unknown-linux-gnu.tar.gz -o /tmp/cncli-<latest_release_version>-x86_64-unknown-linux-gnu.tar.gz
tar xzvf /tmp/cncli-<latest_release_version>-x86_64-unknown-linux-gnu.tar.gz -C /usr/local/bin/
mkdir -p $HOME/.cargo/bin
chown -R $USER\: $HOME/.cargo
touch $HOME/.profile
chown $USER\: $HOME/.profile
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
rustup install stable
rustup default stable
rustup update
rustup component add clippy rustfmt
Adjust the <latest_tag_name>
variable in the command to the latest tag available:
source $HOME/.cargo/env
sudo apt-get update -y && sudo apt-get install -y automake build-essential pkg-config libffi-dev libgmp-dev libssl-dev libtinfo-dev libsystemd-dev zlib1g-dev make g++ tmux git jq wget libncursesw5 libtool autoconf
git clone --recurse-submodules https://github.com/AndrewWestberg/cncli
cd cncli
git checkout <latest_tag_name>
cargo install --path . --force
cncli --version
Run the following command to check if cncli is correctly installed and available in your system PATH
variable:
command -v cncli
It should return /usr/local/bin/cncli
.
Adjust the <latest_tag_name>
variable in the command to the latest tag available:
rustup update
cd cncli
git fetch --all --prune
git checkout <latest_tag_name>
cargo install --path . --force
cncli --version
This automation section of the guide assumes:
- that you have installed
cardano-node
andcardano-cli
in the standard path/usr/local/bin/
- that you have installed
cncli
in the standard path/usr/local/bin/
- that your block producing node port is
3000
- that you sync the
cncli.db
in/root/scripts/
- that you dump the
ledger-state.json
in/root/scripts/
- that you have placed and are running the helper scripts as
root
from/root/scripts/
- that you setup the
cronjobs
in thecrontab
of userroot
- that you have placed your pool
pooltool.json
file in/root/scripts/
- that your
cardano-node
user home is/home/cardano-node/
- that your
/home/cardano-node/
directory contains allcardano-node
directories (config
,db
,keys
andsocket
) - that your socket is
/home/cardano-node/socket/node.socket
Note: should you need to adjust paths, please do so after downloading the scripts and before configuring the services.
The helper scripts rely on jq
, please install it with:
sudo apt-get install -y jq
CNCLI can send your tip and block slots to PoolTool. To do this, it requires that you set up a pooltool.json
file containing your PoolTool API key and stake pool details. Your PoolTool API key can be found on your pooltool profile page. Here's an example pooltool.json
file. Please update with your pool information:
{
"api_key": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"pools": [
{
"name": "BCSH2",
"pool_id": "00beef284975ef87856c1343f6bf50172253177fdebc756524d43fc1",
"host" : "127.0.0.1",
"port": 3000
}
]
}
CNCLI sync
and sendtip
can be easily enabled as systemd
services. When enabled as systemd
services:
sync
will continuously keep thecncli.db
database synchronized.sendtip
will continuously send your stake pooltip
to PoolTool.
To set up systemd
:
- Copy the following to
/etc/systemd/system/cncli-sync.service
[Unit]
Description=CNCLI Sync
After=multi-user.target
[Service]
Type=simple
Restart=always
RestartSec=5
LimitNOFILE=131072
ExecStart=/usr/local/bin/cncli sync --host 127.0.0.1 --port 3000 --db /root/scripts/cncli.db
KillSignal=SIGINT
SuccessExitStatus=143
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=cncli-sync
[Install]
WantedBy=multi-user.target
- Copy the following to
/etc/systemd/system/cncli-sendtip.service
[Unit]
Description=CNCLI Sendtip
After=multi-user.target
[Service]
Type=simple
Restart=always
RestartSec=5
LimitNOFILE=131072
ExecStart=/usr/local/bin/cncli sendtip --cardano-node /usr/local/bin/cardano-node --config /root/scripts/pooltool.json
KillSignal=SIGINT
SuccessExitStatus=143
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=cncli-sendtip
[Install]
WantedBy=multi-user.target
- To enable and run the above services, run:
sudo systemctl daemon-reload
sudo systemctl start cncli-sync.service
sudo systemctl start cncli-sendtip.service
Besides setting up the systemd
services, there are a couple of more automation that CNCLI can help you with. We have devised a few scripts that will be invoked daily with crontab
and that will take care of:
- calculating the
next
epoch assigned slots (withcncli leaderlog
) - send the
previous
andcurrent
assigned slots to PoolTool (withcncli sendslots
). - optionally: query the
ledger-state
and save it to aledger-state.json
file.
Although, by default, the cncli-leaderlog.sh
script will calculate the next
epoch leaderlog
, it can also be run manually to also calculate the previous
and current
epoch slots (adjust the time zone to better suit your location):
bash /root/scripts/cncli-leaderlog.sh previous UTC
bash /root/scripts/cncli-leaderlog.sh current UTC
bash /root/scripts/cncli-leaderlog.sh next UTC
You can get the scripts from here. Place them under /root/scripts/
of the block producing node server of your pool. If you don't have that directory, create it by running the following command as root
:
mkdir /root/scripts/
Important: at the very least, remember to change the pool id in the cncli-leaderlog.sh
script to match your pool.
To set up the cronjobs
, run crontab -e
as root
and paste the following into it and save.
# calculate slots assignment for the next epoch
15 21 * * * /root/scripts/cncli-fivedays.sh && /root/scripts/cncli-leaderlog.sh
# send previous and current epochs slots to pooltool
15 22 * * * /root/scripts/cncli-fivedays.sh && /root/scripts/cncli-sendslots.sh
Optionally set up a cronjob to dump the ledger-state, every day at 3:15 PM.
# query ledger-state and dump to /root/scripts/ledger-state.json
15 15 * * * /root/scripts/ledger-dump.sh