-
Notifications
You must be signed in to change notification settings - Fork 3
/
SmartInstallNode.sh
executable file
·87 lines (80 loc) · 5.12 KB
/
SmartInstallNode.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
# Downloading the wallet
echo 'Downloading and extracting wallet files'
wget "https://github.com/SmartCash/Core-Smart/releases/download/v2.1.1/smartcash-2.1.1-x86_64-linux-gnu.tar.gz" -O - | tar -xz
# Extract the files and give executable permissions
echo 'Copying files to home directory' && sleep 1
cp smartcash-2.1.1/bin/smartcashd ~/
cp smartcash-2.1.1/bin/smartcash-cli ~/ && sleep 1
chmod a+x ~/smartcashd ~/smartcash-cli
# Create wallet directory and set to run when windows is closed.
mkdir ~/.smartcash
echo 'daemon=1' > ~/.smartcash/smartcash.conf
echo 'listen=1' >> ~/.smartcash/smartcash.conf
echo 'maxconnections=64' >> ~/.smartcash/smartcash.conf
echo 'port=9678' >> ~/.smartcash/smartcash.conf
echo '#Use for rpc connections' >> ~/.smartcash/smartcash.conf
echo 'rpcuser='$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 12) >> ~/.smartcash/smartcash.conf
echo 'rpcpassword='$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32) >> ~/.smartcash/smartcash.conf
echo 'rpcport=9679' >> ~/.smartcash/smartcash.conf
echo '#rpcallowip=127.0.0.1' >> ~/.smartcash/smartcash.conf
echo 'server=1' >> ~/.smartcash/smartcash.conf
echo '#Required for Smartnode' >> ~/.smartcash/smartcash.conf
echo 'sapi=1' >> ~/.smartcash/smartcash.conf
echo 'sapiport=8080' >> ~/.smartcash/smartcash.conf
echo '#Remove the hash mark for these two lines and add the key from your local wallet smartnode tab' >> ~/.smartcash/smartcash.conf
echo '#smartnode=1' >> ~/.smartcash/smartcash.conf
echo '#smartnodeprivkey=' >> ~/.smartcash/smartcash.conf
echo "#Uncomment this line if node fails to start because of missing external ip." >> ~/.smartcash/smartcash.conf
echo '#externalip='$(dig +short myip.opendns.com @resolver1.opendns.com) >> ~/.smartcash/smartcash.conf
# Start Wallet
sleep 2 && ./smartcashd && sleep 10
echo "A few more seconds and let's see if it is done loading."
sleep 10 && ./smartcash-cli getinfo
# Create a wallet from mnemonic. (required for 1.0.1+ wallets.)
#./smartcash-cli extkeyimportmaster "$(./smartcash-cli mnemonic new | grep mnemonic | sed -e 's/.*: "//' -e 's/",//')"
# Create a shortcut on system - Unhash if desired
#echo 'Creating symbol link'
#ln -sf ~/smartcash-2.1.1/bin/smartcashd /usr/bin/smartcashd
#ln -sf ~/smartcash-2.1.1/bin/smartcash-cli /usr/bin/smartcash-cli
echo 'To stop wallet ./smartcash-cli stop' > help
echo 'To start ./smartcashd' >> help
echo 'Please add a keep alive setting as a crontab entry to keep your SmartNode running if the server restarts or is accidentally stopped.' >> help
echo 'crontab -e choose nano as an editor and enter at end of file' >> help
echo '*/5 * * * * pidof smartcashd || ~/smartcashd' >> help
echo 'Control x and y to save and quit' >> help
echo "---After you setup your local wallet, complete the SmartNodes tab with your SmartNode info and copy your smartnode key.---" >> help
echo "Place the key in the smartcash.conf here by doing this" >> help
echo "stop with ./smartcash-cli stop" >> help
echo "nano .smartcash/smartcash.conf" >> help
echo "Remove # by the smartnode=1 and smartnodeprvkey= lines and paste your key after the smartnodeprivkey=" >> help
echo "control x and y to save and start with ./smartcashd" >> help
echo "After node is synced issue a start on your local wallet by right clicking on the entry and start alias." >> help
echo "Port 8080 and 9678 must be open to outside the network" >> help
echo "---A swap file is needed if RAM is less than 4GB---" >> help
echo "sudo fallocate -l 4G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile" >> help
echo "Edit /etc/fstab and add line" >> help
echo "sudo nano /etc/fstab" >> help
echo "Paste this lline at end of file /swapfile swap swap defaults 0 0 and close with Control x and y" >> help
echo "To show this help again type 'cat help'" >> help
echo 'Installation finished.'
echo 'To stop wallet ./smartcash-cli stop'
echo 'To start ./smartcashd'
echo 'Please add a keep alive setting as a crontab entry to keep your SmartNode running if the server restarts or is accidentally stopped.'
echo 'crontab -e choose nano as an editor and enter at end of file'
echo '*/5 * * * * pidof smartcashd || ~/smartcashd'
echo 'Control x and y to save and quit'
echo "---After you setup your local wallet, complete the SmartNodes tab with your SmartNode info and copy your smartnode key.---"
echo "Place the key in the smartcash.conf here by doing this"
echo "stop with ./smartcash-cli stop"
echo "nano .smartcash/smartcash.conf"
echo "Remove # by the smartnode=1 and smartnodeprvkey= lines and paste your key after the smartnodeprivkey="
echo "control x and y to save and start with ./smartcashd"
echo "After node is synced issue a start on your local wallet by right clicking on the entry and start alias."
echo "Port 8080 and 9678 must be open to outside the network"
echo "---A swap file is needed if RAM is less than 4GB---"
echo "sudo fallocate -l 4G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile"
echo "Edit /etc/fstab and add line"
echo "sudo nano /etc/fstab"
echo "Paste this line at end of file /swapfile swap swap defaults 0 0 and close with Control x and y"
echo "To show this help again type 'cat help'"