Hello all,

Apologies for the large pause since the last blog post.

Many people have come into the securenode channel on discord with the same questions. This blog post intends on creating a command line (CLI) cheat sheet for commonly used commands on the securenode.

Updating your zen software

The zend daemon from the APT repository

To install the updated daemon with minimal downtime you can do the following:

sudo apt-get update
sudo apt-get install zen
zen-cli stop
wait 5 seconds
zend
You can verify that you are at the latest version by running:
zen-cli getnetworkinfo

Current version is
"version": 2001150, "subversion": "/zen:2.0.11/",

The zend daemon from source

Navigate to the zen directory, if you followed mine or Blockops guides this will be located in the zencash directory:
cd ~/zencash/zen/

Next we need to fetch the updated code:
git fetch origin
git checkout master

Note: if it asks you to 'git pull' please run
git pull

Now we need to build the daemon:
./zcutil/build.sh -j$(nproc)

Now we need to stop the zend daemon and update zend and zen-cli binaries in /usr/bin. This can be done by running the following commands, if you use monit to run your zend daemon.
sudo monit stop zend
wait 5 seconds
sudo cp src/zend /usr/bin
sudo cp src/zen-cli /usr/bin
sudo monit start zend
If you do not use monit you can stop the daemon by running:
zen-cli stop
then wait 5 seconds
sudo cp src/zend /usr/bin
sudo cp src/zen-cli /usr/bin
And finally starting the daemon again:
zend

Updating the securenode tracker software

hange to the secnodetracker folder and update the tracker application. This may be '~/zencash/secnodetracker' if the install guides were followed.

Run the following commands:
git fetch origin
git checkout master
git pull

If git complains about overwritting a file use: git checkout -- filename
Then run the above commands again

Run setup (this will refresh the list of servers) in the scenodetracker folder. You should be able to accept all the previous values.
node setup

Stop the tracker application and restart it
press Ctrl-c if running manually and then node app

or restart using your managment application such as PM2
pm2 restart 0
To check the pm2 process is running correctly please run pm2 logs and look for the absence of errors.

Sending funds away from the z-address on the node

You can either use:
zen-cli z_sendmany "<z-address>" "[{\"amount\": <x>, \"address\": \"<receiving-address>\"}]"
or
zen-cli z_sendmany '<z-address>' '[{"address": "<receiving-address>", "amount": <x>}]'

In both of these commands you will need to change the <z-address>, <receiving-address>, and <x> place holders with the address you are sending from, the address you are sending to, and the amount you want to send.

Here are an example of both of these commands:
zen-cli z_sendmany "ztV8BetL5pMFvH7U7Sdrs9E43iW42YNvthD5RWHr5nUBfVu68qTp2bBfB8JpLjjdNJTJMqpdaYN92zVL6GoWayYs2w5MGyT" "[{\"amount\": 1, \"address\": \"ztgJrsxYSoeiGcNCcQwxo73Goq4UPcqVoef\"}]"
or
zen-cli z_sendmany 'ztV8BetL5pMFvH7U7Sdrs9E43iW42YNvthD5RWHr5nUBfVu68qTp2bBfB8JpLjjdNJTJMqpdaYN92zVL6GoWayYs2w5MGyT' '[{"address": "ztgJrsxYSoeiGcNCcQwxo73Goq4UPcqVoef", "amount": 1}]'

List addresses in the wallet on the node

To see the t-addresses on the node, you can run:
zen-cli listaddresses

To see the z-addresses on the node, you can run:
zen-cli z_listaddresses

List various balances on the node

To see the total balance on the node, including the z-address, you can run:
zen-cli z_gettotalbalance

To see the balance in each t-address:
zen-cli listaddressgroupings

To see the individual balances in z-addresses:
zen-cli z_getbalance <z-address>
you will need to replace the <z-address> place holder with the address you are interested in getting the balance for, here is an example:
zen-cli z_getbalance ztV8BetL5pMFvH7U7Sdrs9E43iW42YNvthD5RWHr5nUBfVu68qTp2bBfB8JpLjjdNJTJMqpdaYN92zVL6GoWayYs2w5MGyT

Exporting the private keys

To get the private key for the t-address:
zen-cli dumpprivkey <t-address>
you will need to replace the <t-address> place holder with your t-address. Here is an example of that command:
zen-cli dumpprivkey ztgJrsxYSoeiGcNCcQwxo73Goq4UPcqVoef

To get the private key for the z-address
zen-cli z_exportkey <z-address>
You will need to replace the <z-address> place holder. Here is an example of the command:
zen-cli z_exportkey ztV8BetL5pMFvH7U7Sdrs9E43iW42YNvthD5RWHr5nUBfVu68qTp2bBfB8JpLjjdNJTJMqpdaYN92zVL6GoWayYs2w5MGyT

Getting your block height

To get your block height you can run:
zen-cli getinfo | grep blocks

If you think I have missed some common commands, and you would like me to add them to this list, please post a message below and I will add them.

Have a great weekend.