-
Notifications
You must be signed in to change notification settings - Fork 2
/
SETUP-CHIA-FULL-NODE.sh
84 lines (71 loc) · 3.34 KB
/
SETUP-CHIA-FULL-NODE.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
#!/bin/bash
# Chia Full Node Setup
# By Rahim Khoja ([email protected])
# https://www.linkedin.com/in/rahim-khoja-879944139/
echo
echo -e "\033[0;31m░░░░░░░░▀▀▀██████▄▄▄"
echo "░░░░░░▄▄▄▄▄░░█████████▄ "
echo "░░░░░▀▀▀▀█████▌░▀▐▄░▀▐█ "
echo "░░░▀▀█████▄▄░▀██████▄██ "
echo "░░░▀▄▄▄▄▄░░▀▀█▄▀█════█▀"
echo "░░░░░░░░▀▀▀▄░░▀▀███░▀░░░░░░▄▄"
echo "░░░░░▄███▀▀██▄████████▄░▄▀▀▀██▌"
echo "░░░██▀▄▄▄██▀▄███▀▀▀▀████░░░░░▀█▄"
echo "▄▀▀▀▄██▄▀▀▌█████████████░░░░▌▄▄▀"
echo "▌░░░░▐▀████▐███████████▌"
echo "▀▄░░▄▀░░░▀▀██████████▀"
echo "░░▀▀░░░░░░▀▀█████████▀"
echo "░░░░░░░░▄▄██▀██████▀█"
echo "░░░░░░▄██▀░░░░░▀▀▀░░█"
echo "░░░░░▄█░░░░░░░░░░░░░▐▌"
echo "░▄▄▄▄█▌░░░░░░░░░░░░░░▀█▄▄▄▄▀▀▄"
echo -e "▌░░░░░▐░░░░░░░░░░░░░░░░▀▀▄▄▄▀\033[0m"
echo "---The Chia Full Node Setup Script---"
echo "---By: Rahim Khoja ([email protected])---"
echo
# Requirements: Ubuntu 20.04 LTS (Desktop Minimal)
# Internet Access
# A SSD Boot Disk (Chia seems to need this) [It May be fine with 7200RPM+ Disk]
# Stop on Error
set -eE # same as: `set -o errexit -o errtrace`
# Failure Function
function failure() {
local lineno=$1
local msg=$2
echo ""
echo -e "\033[0;31mError at Line Number $lineno: '$msg'\033[0m"
echo ""
}
# Failure Function Trap
trap 'failure ${LINENO} "$BASH_COMMAND"' ERR
# Check the bash shell script is being run by root/sudo
if [[ $EUID -ne 0 ]];
then
echo "This script must be run with sudo" 1>&2
exit 1
fi
# Update and Upgrade System
apt -y update
apt -y upgrade
apt -y install git
apt -y install python3
apt -y install python3-pip
# Install Chia as Chia-Node User
cd /usr/share
git clone https://github.com/Chia-Network/chia-blockchain.git -b latest --recurse-submodules
chmod -R 777 /usr/share/chia-blockchain
sudo -u chia-node -- sh -c "cd /usr/share/chia-blockchain; sh install.sh"
# Install Chia Gui as Plotter User
sudo -u chia-node -- sh -c "cd /usr/share/chia-blockchain; . ./activate; sh install-gui.sh"
# Crate CHIA & Swar Log Dir
mkdir /var/log/chia || true
chmod -R 777 /var/log/chia
# Stop Chia Daemon
sudo -u plotter -- sh -c "/usr/share/chia-blockchain/venv/bin/chia stop all -d" || true
echo "Chia Config File: /home/plotter/.chia/mainnet/config/config.yaml (Only Appears After 'chia init' Command is Run)"
echo "Chia Bin File: /usr/share/chia-blockchain/venv/bin/chia"
echo "Chia Bin Directory: /usr/share/chia-blockchain/venv/bin"
echo
echo
echo "Follow Guide Here Before Running SWAR: https://github.com/Chia-Network/chia-blockchain/wiki/Farming-on-many-machines"
echo