What to do with spare CPU Capacity on a Relay node

Hi everyone,

This might have been something that crossed your minds as it has certainly crossed mine: I am running a Relay node that is up all day and is maxed out on its RAM , but significantly sub utilized on the CPU.

On a 16GB and 4 core machine my RAM is around 65% utilized most of the time and CPU rarely ticks over 5% across all cores

If you are running the machine in a cloud - that is hopefully powered by ecologically sourced energy - then the CPU time is pretty much wasted and the RAM is almost fully utilized. A sub-optimal use of resources

So what can you do with the left over CPU:

1 - Run services that the community as a whole could utilize, such as a GraphQL service and make it open to the public. Imagine if every relay node could be a gateway to the blockchain and be open to the public. This would make something like a decentralized Infura service but for Cardano, or;

2 - Run a proof-of-work miner that would be heavy on the CPU and light on the RAM. Such as Monero XMR token miner.

I am working on the 1st option, but have tried the second option with acceptable results. I should say that this is probably best suited for those pool that are not minting blocks every epoch and need to an extra source of income to help pay for the hardware. I would not advise to run this on a node that is minting multiple per epoch.

Disclaimer: I do not get rewarded by monero or any other services for this, I am not advertising anything. I have found that this yields around $20 extra per year on a low spec cloud machine that is just strong enough to run the cardano node

What you need to get started:

  • log into your server with ssh
  • install xmrig which is mining software for Monero XMR Link
  • create a Monero wallet where your rewards will be paid and generated a public key
  • make sure you have tmux installed, if not then install it, guide by this Link
  • start a tmux session and launch the proof of steak miner (code below). Don’t forget to replace MoneroPublicKeyGoesHere with your Monero public key

You should then tweak CPUQuota parameter to something that suits you - I found that tweaking this parameter to the point where my CPU is at 90% utilization keeps the cardano node responsive yet produces acceptable mining rewards.

You can then check your rewards and the payout thresholds at supportxmr.com

tmux new -s xmr

sudo -E env PATH=$PATH systemd-run -p CPUQuota="450%" --scope --uid=$USER --gid=$USER -- /home/cardano/xmr/xmrig -o pool.supportxmr.com:443 -u MoneroPublicKeyGoesHere hCr -k --tls -p worker1

Comments and suggestions always welcome

All the best

Here are my 2 Lovelaces.

Option 1: This could certainly be a valuable service and will likely see increased need going forward. I believe it is also fairly straightforward to implement using Cntools.

Option 2: Monero is very difficult to mine profitably, and even then they are very slim profits. BUT, it does make for a nice space heater if you have liquid cooling, otherwise it is just loud and annoying. Winter is coming around fast I may try this when my tootsies/office gets cold.

This is probably more suite if its not run form under your desk, or you have a wind turbine powering your nodes and need to transform that into heat. The real use case is if your CPU time is trully wasted and you want to find good use for it - the main purpose is to run a cardano node and monero mining can make you some change