forked from NodersUA/Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fleek-lightning
127 lines (95 loc) · 3.86 KB
/
fleek-lightning
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/bash
# Logo
curl -s https://raw.githubusercontent.com/NodersUA/Scripts/main/logo.sh | bash
#=======================================================
# Menu
PS3='Select an action: '
options=(
"Install Node"
"Delete"
"Exit")
#=======================================================
select opt in "${options[@]}"
do
case $opt in
"Install Node")
#adduser lgtn
#usermod -aG sudo lgtn
#su lgtn
#cd /home/lgtn
sudo ufw allow 4200:4299/tcp
sudo ufw allow 4300:4399/udp
sudo apt-get update && \
sudo apt-get upgrade -y && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# press 1) Proceed with installation (default)
source "$HOME/.cargo/env"
rustup default stable-x86_64-unknown-linux-gnu && \
sudo apt-get install build-essential -y && \
sudo apt-get install cmake clang pkg-config libssl-dev gcc-multilib -y && \
sudo apt-get install protobuf-compiler
git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning && \
cd ~/fleek-network/lightning && \
cargo clean && cargo update && cargo +stable build --release
sudo ln -s ~/fleek-network/lightning/target/release/lightning-node /usr/local/bin/lgtn
lgtn keys generate
sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"
sudo tee /etc/systemd/system/lightning.service > /dev/null <<EOF
[Unit]
Description=Fleek Network Node lightning service
[Service]
Type=simple
MemoryHigh=32G
RestartSec=15s
Restart=always
ExecStart=lgtn -c /home/lgtn/.lightning/config.toml run
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log
Environment=TMPDIR=/var/tmp
[Install]
WantedBy=multi-user.target
EOF
sudo chmod 644 /etc/systemd/system/lightning.service
#sudo systemctl daemon-reload && \
#sudo systemctl enable lightning
#sudo mkdir -p /var/log/lightning
#sudo touch /var/log/lightning/output.log
#sudo touch /var/log/lightning/diagnostic.log
#sudo systemctl restart lightning.service
echo '=============== INSLALL FINISHED ==================='
echo -e "To check logs output: \e[1m\e[33mtail -fn100 /var/log/lightning/output.log\e[0m"
echo -e "To check logs diagnostic: \e[1m\e[33mtail -fn100 /var/log/lightning/diagnostic.log\e[0m"
sudo tee /home/lgtn/fleek-network/stake-instuction.txt > /dev/null <<EOF
Open the Metamask settings, located in the drop-down (top-right menu options). Set the following property values:
Network Name: Fleek Network Testnet
RPC URL: https://rpc.testnet.fleek.network/rpc/v0
Chain ID: 59330
Currency symbol: tFLK
Before proceeding, make sure to have the Fleek Network selected as the metamask network. Once confirmed, visit the Faucet website
In the Faucet website, you have to click the Connect Wallet
Once Connect Wallet is ready, proceed to Mint tFLK and wait until the balance of the account in your Metamask increases. You need to have tFLK before proceeding. Be patient.
Once tFLK balance is available, click in the Stake button. You'll be required to provided the following details from your node:
Node Public Key
Consensus Public Key
Server IP Address
You can get the details quickly by running the node details script in the terminal connected to your machine or server where the node is set up and running, as follows:
EOF
cat /home/lgtn/fleek-network/stake-instuction.txt | while IFS= read -r line; do echo -e "\e[34m$line\e[0m"; done
curl https://get.fleek.network/node_details | bash
echo -e "To check node details: \e[1m\e[33mcurl https://get.fleek.network/node_details | bash\e[0m"
echo -e "To check IP: \e[1m\e[33mwget -qO- eth0.me\e[0m"
echo -e "Check node health: \e[1m\e[33mcurl -sS https://get.fleek.network/healthcheck | bash\e[0m"
break
;;
#=======================================================
"Delete")
echo "Sonn..."
break
;;
#=======================================================
"Exit")
exit
;;
*) echo "Invalid option. Please try again.";;
esac
done