-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathironfish-node.sh
90 lines (70 loc) · 2.61 KB
/
ironfish-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
85
86
87
88
89
90
#!/bin/bash
###### install node.js
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - && apt-get install -qq -y nodejs
###### install ironfish binary
npm install -g ironfish
npm update -g ironfish
###### download ironfish chain snapshot
ironfish chain:download --confirm
##### Setup account
echo "Enter required variables and remember(!): "
read -p "Graffiti name:" IRONFISH_GRAFFITI_NAME
read -p "Node name: " IRONFISH_GRAFFITI_NAME
if [ ${SHELL} == "/usr/bin/zsh" ]; then
echo "export IRONFISH_GRAFFITI_NAME=${IRONFISH_GRAFFITI_NAME} >> $HOME/.zshrc"
echo "export IRONFISH_NODE_NAME=${IRONFISH_NODE_NAME} >> $HOME/.zshrc"
else
echo "export IRONFISH_GRAFFITI_NAME=${IRONFISH_GRAFFITI_NAME} >> $HOME/.bashrc"
echo "export IRONFISH_NODE_NAME=${IRONFISH_NODE_NAME} >> $HOME/.bashrc"
fi
ironfish wallet:create ${IRONFISH_GRAFFITI_NAME}
ironfish wallet:use ${IRONFISH_GRAFFITI_NAME}
ironfish config:set blockGraffiti ${IRONFISH_GRAFFITI_NAME}
ironfish config:set accountName ${IRONFISH_GRAFFITI_NAME}
ironfish config:set nodeName ${IRONFISH_NODE_NAME}
ironfish config:set blockGraffiti "${IRONFISH_GRAFFITI_NAME}"
ironfish config:set enableTelemetry "true"
mkdir -p ${HOME}/.ironfish/privkeys/
ironfish wallet:export ${HOME}/.ironfish/privkeys/${IRONFISH_GRAFFITI_NAME}_backup.json
##### Setup systemd service
echo "[Unit]
Description=Ironfish node
After=network-online.target
[Service]
User=root
ExecStart=$(which ironfish) start
Restart=always
RestartSec=5
LimitNOFILE=30000
OOMScoreAdjust=0
LimitAS=infinity
LimitCPU=infinity
LimitFSIZE=infinity
LimitAS=infinity
LimitNPROC=30000
LimitMEMLOCK=inifinity
CPUSchedulingPolicy=other
CPUSchedulingPriority=0
MemoryHigh=$(shuf -i 60-80 | head -1)%
Nice=-$(shuf -i 10-18 | head -1)
TasksMax=infinity
TasksAccounting=false
[Install]
WantedBy=multi-user.target
" > /etc/systemd/system/ironfishd.service
systemctl daemon-reload
systemctl enable ironfishd.service
systemctl restart ironfishd.service
#######
echo ""
echo "############# Information #############"
echo "Using ironfish account: $(ironfish wallet:which)"
echo "Wallet backup can be found in file: ${HOME}/.ironfish/privkeys/${IRONFISH_GRAFFITI_NAME}_backup.json"
echo "Account used now: $(ironfish wallet:which)"
echo "Account balance: $(ironfish wallet:balance)"
echo ""
echo "############# Ironfish commands #############"
echo "Get coins from faucet: ironfish faucet"
echo "Check node health status: ironfish status | grep Blockchain | awk '{print $NF}'"
echo "Check current ironfish systemd service status: systemctl status ironfishd.service"
echo "Check last ironfish systemd service logs: journalctl -n500 -efu ironfishd.service"