Skip to content

Instantly share code, notes, and snippets.

@lukestokes
Last active May 2, 2020 07:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save lukestokes/9530eb772f111b1cec9382d0088808ad to your computer and use it in GitHub Desktop.
Save lukestokes/9530eb772f111b1cec9382d0088808ad to your computer and use it in GitHub Desktop.
Script for copying from an already synced SmartCash SmartNode to a SmartNode01, SmartNode02, etc folder.
#!/bin/bash
# create_node.sh
# adapted from https://github.com/SmartCash/smartnode/blob/master/install.sh
# Requirements: have a fully synced up node in this folder: ~/smartcash/SmartNode_bootstrap (no smartcash.conf needed)
# You'll be prompted for your GenKey, IP, Node Number (01, 02, 03, etc), and RPC port
if [ "$(whoami)" != "root" ]; then
echo "Script must be run as user: root"
exit -1
fi
# Get a new privatekey by going to console >> debug and typing smartnode genkey
printf "SmartNode GenKey: "
read _nodePrivateKey
# The RPC node will only accept connections from your localhost
_rpcUserName=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 12 ; echo '')
# Choose a random and secure password for the RPC
_rpcPassword=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32 ; echo '')
# Get the IP address of your vps which will be hosting the smartnode
printf "SmartNode IP: "
read _nodeIpAddress
# Get the IP address of your vps which will be hosting the smartnode
printf "SmartNode Number: "
read _nodeNumber
# Get the IP address of your vps which will be hosting the smartnode
printf "SmartNode RPC Port: "
read _nodeRPCPort
# Make a new directory for smartcash daemon
cp -r ~/smartcash/SmartNode_bootstrap ~/smartcash/SmartNode${_nodeNumber}
touch ~/smartcash/SmartNode${_nodeNumber}/smartcash.conf
# Change the directory to ~/.smartcash
cd ~/smartcash/SmartNode${_nodeNumber}
# Create the initial smartcash.conf file
echo "rpcuser=${_rpcUserName}
rpcpassword=${_rpcPassword}
rpcallowip=127.0.0.1
listen=1
server=1
daemon=1
logtimestamps=1
maxconnections=64
txindex=1
smartnode=1
port=9678
externalip=${_nodeIpAddress}
bind=${_nodeIpAddress}
rpcport=${_nodeRPCPort}
smartnodeprivkey=${_nodePrivateKey}
" > smartcash.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment