Scripts for Managing Multiple SmartCash Smart Nodes on One Server

I finally got all my Smart Nodes up and running (see my previous post for more on what a Smart Node is) and needed to create some scripts to manage them.

This isn't really a start up guide as much as it tells a story of what I did, and it might be helpful for those who already understand how Smart Nodes work, but want some scripts to manage multiple nodes on a server.

The first step on my new box was to get IP addresses added.

Adding lines like this in the iface eth0 inet static block inside /etc/network/interfaces/ did the trick:

  up route add -net x.x.x.11 netmask 255.255.255.240 gw y.y.y.y eth0
  up ip addr add x.x.x.11/28 dev eth0
  up ip addr add x.x.x.12/28 dev eth0

Where y.y.y.y is the main server IP and x.x.x.11, x.x.x.12, x.x.x.13, etc are the IPs we want to add. This example assumes you have a /28 which has 15 usable IPs. The 11, 12, 13 are just examples.

Next I followed the start up guide and will add notes here starting with these parts:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:smartcash/ppa
sudo apt-get update
sudo apt-get install smartcashd

mkdir ~/smartcash/
mkdir ~/smartcash/SmartNode_bootstrap
cd ~/smartcash/

You can use all of the scripts I made on your server as well (make sure they are executable via chmod +x <file>). A lot of these borrow heavily from the scripts you can find here: https://github.com/SmartCash/smartnode but have been modified to handle multiple nodes.

  • create_node.sh
    Script for copying from an already synced SmartCash SmartNode to a SmartNode01, SmartNode02, etc folder.

  • clear_all_logs.sh
    Clears all log files every other day

  • smart-cli.sh
    Call smartcash-cli for a specific node

  • checkdaemons.sh
    If the blocknumber isn't increasing, restart the deamon.

  • makerun.sh
    Make sure each smart node is running. If it's not, restart it.

  • printblocks.sh
    Print out the current block numbers for all nodes.

  • smart-start.sh
    Start a specific Smart Node.

Start with a bootstrap of the blockchain via:

wget http://proteanx.com/txindexstrap.zip
unzip txindexstrap.zip

Copy those folders into SmartNode_bootstrap and start up your server via smart-start.sh:

./smart-start.sh _bootstrap

That will take a long time to sync up. You check the status with:

./smart-cli.sh _bootstrap getinfo

Once it's done, you're ready to start creating your nodes. First, shut it down:

./smart-cli.sh _bootstrap stop

Now you should be ready. Have all your GenKeys, IPs, Node Numbers, and RPC Ports ready. I just increment the Node Numbers (01, 02, 03, etc) and RPC Ports (9679, 9680, 9681, etc)

./create_node.sh

The just fill in the prompts starting with your first node (01), and you should be good to go. Next just start your first node with:

./smart-start.sh 01

Verify it's working with:

./smart-cli.sh 01 getinfo

Once you get all your nodes set up, create two text files start_number.txt and end_number.txtand put in them your start and end numbers for how many nodes you have. For example, if you had 30 nodes on one machine, put a single 1 in start_number.txt and 30 in end_number.txt.

If you have additional servers to set up, I recommend zipping up the SmartNode_bootstrap folder and sending it to the new server via scp to save you some time.

I also set the following crontab entries to ensure the log files don't get too big, the blocknumbers are increasing, and the daemons are running:

0 0 */2 * * ~/smartcash/clear_all_logs.sh
*/2 * * * * ~/smartcash/makerun.sh
*/30 * * * * ~/smartcash/checkdaemons.sh

I spent quite a bit of time putting these scripts together to manage my nodes, so I hope it saves you some time.

Please don't ask me what the future price of SmartCash will be or if Smart Nodes will remain this profitable for long. I have no idea.

Using this calculator tool by @bitcoiner as a guide, here's what we see now:

Sounds crazy, right?

I don't know if we'll end up having > 50,000 nodes or if the price will go down or what. Maybe hyperinflation will tank the price. Maybe node opperators will regularly sell to add down pressure. At this point, I'm treating all of this as pretend money until it has a lot more volume, is traded on a lot more exchanges, and has a lot more use-cases as cash in real-world situations. For now, I'm just having fun, taking a risk on a relatively new project.

The Smart Cash team has dealt with quite a few bumps and bruises lately. They had an issue with the zerocoin protocol which may have led to some hacked coins (I'm still waiting for an official announcement from their team on that). Fixing that caused problems for exchanges, including Cryptopia which, as of this post, is delisting SmartCash (you can still get them on Crypto Bridge).

The rollout of Smart Nodes went fairly well, but there's also some issues with the rewards payout not being correct and some (like myself) not getting any rewards while others are getting double rewards. Hopefully this will be fixed by their team very soon. I like how they are communicating well about the issue:

You can find out more via their Discord channel.

Here are my previous Smart Cash Posts:


Luke Stokes is a father, husband, business owner, programmer, STEEM witness, and voluntaryist who wants to help create a world we all want to live in. Visit UnderstandingBlockchainFreedom.com

I'm a Witness! Please vote for @lukestokes.mhth

H2
H3
H4
3 columns
2 columns
1 column
69 Comments