-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathokp4.sh
112 lines (94 loc) · 11.8 KB
/
okp4.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
clear
echo "==================================================================="
echo -e "\e[92m"
echo " ____ ____ _ ";
echo " | __ ) __ _ | _ \ __ _| |_ ___ _ __ __ _ ";
echo " | _ \ / _' | | |_) / _' | __/ _ \ '_ \ / _' | ";
echo " | |_) | (_| | | __/ (_| | || __/ | | | (_| | ";
echo " |____/ \__, | |_| \__,_|\__\___|_| |_|\__, | ";
echo " |___/ |___/ ";
echo -e "\e[0m"
echo "==================================================================="
echo -e '\e[36mAuthor :\e[39m' Bang Pateng
echo -e '\e[36mTelegram Group :\e[39m' @bangpateng_group
echo -e '\e[36mTelegram Channel :\e[39m' @bangpateng_airdrop
echo -e '\e[36mYoutube :\e[39m' www.youtube.com/c/BangPateng/
echo -e '\e[36mWebsite :\e[39m' www.bangpatengnode.site
sleep 2
# set vars
if [ ! $NODENAME ]; then
read -p "Masukan Nama Validator Kalian: " NODENAME
echo 'export NODENAME='$NODENAME >> $HOME/.bash_profile
fi
if [ ! $WALLET ]; then
echo "export WALLET=wallet" >> $HOME/.bash_profile
fi
echo "export OKP4_CHAIN_ID=okp4-nemeton" >> $HOME/.bash_profile
source $HOME/.bash_profile
echo '================================================='
echo -e "Your node name: \e[1m\e[32m$NODENAME\e[0m"
echo -e "Your wallet name: \e[1m\e[32m$WALLET\e[0m"
echo -e "Your chain name: \e[1m\e[32m$OKP4_CHAIN_ID\e[0m"
echo '================================================='
sleep 2
echo -e "\e[1m\e[32m1. Updating packages... \e[0m" && sleep 1
# update
cd $HOME
sudo apt update
sudo apt install make clang pkg-config libssl-dev build-essential git jq ncdu bsdmainutils htop -y
echo -e "\e[1m\e[32m2. Install Golang... \e[0m" && sleep 1
# install golang
cd $HOME
wget -O go1.19.2.linux-amd64.tar.gz https://golang.org/dl/go1.19.2.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.19.2.linux-amd64.tar.gz && rm go1.19.2.linux-amd64.tar.gz
echo 'export GOROOT=/usr/local/go' >> $HOME/.bash_profile
echo 'export GOPATH=$HOME/go' >> $HOME/.bash_profile
echo 'export GO111MODULE=on' >> $HOME/.bash_profile
echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> $HOME/.bash_profile && . $HOME/.bash_profile
go version
echo -e "\e[1m\e[32m3. Install Software... \e[0m" && sleep 1
# install Software
rm -rf $HOME/okp4d
git clone https://github.com/okp4/okp4d.git
cd okp4d && git checkout v2.2.0
make build
sudo mv ./target/dist/okp4d /usr/local/bin/ || exit
okp4d init $NODENAME --chain-id $OKP4_CHAIN_ID
peers="[email protected]:2280,[email protected]:26656,[email protected]:26656,[email protected]:26706,[email protected]:26656,[email protected]:10096,[email protected]:26656,[email protected]:36656,[email protected]:16656,[email protected]:26656,[email protected]:53656,[email protected]:26656,[email protected]:6040,[email protected]:26656,[email protected]:26656,[email protected]:28656,[email protected]:26656,[email protected]:16656,[email protected]:36656,[email protected]:60756,[email protected]:25656,[email protected]:28656,[email protected]:26656,[email protected]:26656,[email protected]:36656,[email protected]:56656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:60656,[email protected]:26656,[email protected]:55156,[email protected]:26656,[email protected]:26656,[email protected]:2456,[email protected]:26656,[email protected]:26656,[email protected]:11656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:16656,[email protected]:26656,[email protected]:26656,[email protected]:56656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:46656,[email protected]:26656,[email protected]:26656,[email protected]:60656,[email protected]:26656,[email protected]:26656,[email protected]:33656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:29656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:27363,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:36656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:46656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:11656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:10656,[email protected]:26656,[email protected]:26656,[email protected]:36656,[email protected]:23856,[email protected]:26656,[email protected]:26656,[email protected]:36656,[email protected]:26656,[email protected]:656,[email protected]:26656,[email protected]:46656,[email protected]:26656,[email protected]:26656,[email protected]:26858,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:37656,[email protected]:26656,[email protected]:12656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:37656,[email protected]:2456,[email protected]:2456,[email protected]:26656,[email protected]:26656,[email protected]:11014,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656"
#sed -i "s/^seeds *=.*/seeds = \"$seeds\"/;" $HOME/.okp4d/config/config.toml
sed -i.default "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/;" $HOME/.okp4d/config/config.toml
echo -e "\e[1m\e[32m4. Set Service... \e[0m" && sleep 1
sed -i.default "s/pruning *=.*/pruning = \"custom\"/g" $HOME/.okp4d/config/app.toml
sed -i "s/pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/g" $HOME/.okp4d/config/app.toml
sed -i "s/pruning-interval *=.*/pruning-interval = \"10\"/g" $HOME/.okp4d/config/app.toml
#sed -i "s/snapshot-interval *=.*/snapshot-interval = 0/g" $HOME/.okp4d/config/app.toml
sed -i -e "s/indexer *=.*/indexer = \"null\"/g" $HOME/.okp4d/config/config.toml
wget -O $HOME/.okp4d/config/genesis.json https://raw.githubusercontent.com/okp4/networks/main/chains/nemeton/genesis.json
okp4d tendermint unsafe-reset-all
wget -O $HOME/.okp4d/config/addrbook.json https://api.nodes.guru/okp4_addrbook.json
sudo tee /etc/systemd/system/okp4d.service > /dev/null <<EOF
[Unit]
Description=okp4d Node
After=network.target
[Service]
User=$USER
Type=simple
ExecStart=/usr/local/bin/okp4d start
Restart=on-failure
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target" > $HOME/okp4d.service
sudo mv $HOME/okp4d.service /etc/systemd/system
sudo tee <<EOF >/dev/null /etc/systemd/journald.conf
Storage=persistent
EOF
echo -e "\e[1m\e[32m5. Running Service... \e[0m" && sleep 1
sudo systemctl restart systemd-journald
sudo systemctl daemon-reload
sudo systemctl enable okp4d
sudo systemctl restart okp4d
echo '=============== SETUP FINISH BANG EASY BANGET KAN ==================='
echo -e 'To check logs: \e[1m\e[32msudo journalctl -u okp4d -f -o cat\e[0m'
echo -e "To check sync status: \e[1m\e[32okp4d status 2>&1 | jq .SyncInfo\e[0m" && sleep 1