-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefund.sh
97 lines (85 loc) · 4.28 KB
/
defund.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
#!/bin/bash
exists()
{
command -v "$1" >/dev/null 2>&1
}
if exists curl; then
echo ''
else
sudo apt update && sudo apt install curl -y < "/dev/null"
fi
bash_profile=$HOME/.bash_profile
if [ -f "$bash_profile" ]; then
. $HOME/.bash_profile
fi
sleep 1 && curl -s https://api.nodes.guru/logo.sh | bash && sleep 1
if [ ! $DEFUND_NODENAME ]; then
read -p "Enter node name: " DEFUND_NODENAME
echo 'export DEFUND_NODENAME='\"${DEFUND_NODENAME}\" >> $HOME/.bash_profile
fi
echo 'source $HOME/.bashrc' >> $HOME/.bash_profile
. $HOME/.bash_profile
sleep 1
cd $HOME
sudo apt update
sudo apt install make clang pkg-config libssl-dev build-essential git jq ncdu bsdmainutils htop -y < "/dev/null"
echo -e '\n\e[42mInstall Go\e[0m\n' && sleep 1
cd $HOME
wget -O go1.19.1.linux-amd64.tar.gz https://golang.org/dl/go1.19.1.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.19.1.linux-amd64.tar.gz && rm go1.19.1.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 '\n\e[42mInstall software\e[0m\n' && sleep 1
rm -rf $HOME/defund
git clone https://github.com/defund-labs/defund
cd defund
git checkout v0.2.2
make build
sudo mv ./build/defundd /usr/local/bin/ || exit
defundd init "$DEFUND_NODENAME" --chain-id=defund-private-4
seeds="[email protected]:26656,[email protected]:26656,[email protected]:56656,[email protected]:17000,[email protected]:45656,74e6425e7ec76e6eaef92643b6181c42d5b8a3b8@defund-testnet-seed.itrocket.net:443"
#peers="[email protected]:26677,[email protected]:60556,[email protected]:56656,[email protected]:26656,[email protected]:36656,[email protected]:29656"
sed -i.default "s/^seeds *=.*/seeds = \"$seeds\"/;" $HOME/.defund/config/config.toml
#sed -i "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/;" $HOME/.defund/config/config.toml
sed -i.default -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.0025ufetf\"/" $HOME/.defund/config/app.toml
sed -i "s/pruning *=.*/pruning = \"custom\"/g" $HOME/.defund/config/app.toml
sed -i "s/pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/g" $HOME/.defund/config/app.toml
sed -i "s/pruning-interval *=.*/pruning-interval = \"10\"/g" $HOME/.defund/config/app.toml
#sed -i "s/snapshot-interval *=.*/snapshot-interval = 0/g" $HOME/.defund/config/app.toml
#sed -i.bak -e "s/indexer *=.*/indexer = \"null\"/g" $HOME/.defund/config/config.toml
wget -O $HOME/.defund/config/genesis.json https://raw.githubusercontent.com/defund-labs/testnet/main/defund-private-4/genesis.json
defundd tendermint unsafe-reset-all
#wget -O $HOME/.defund/config/addrbook.json https://api.nodes.guru/defund_addrbook.json
echo -e '\n\e[42mRunning\e[0m\n' && sleep 1
echo -e '\n\e[42mCreating a service\e[0m\n' && sleep 1
# echo "[Unit]
# Description=DeFund Node
# After=network.target
# [Service]
# User=$USER
# Type=simple
# ExecStart=/usr/local/bin/defundd start
# Restart=on-failure
# LimitNOFILE=65535
# [Install]
# WantedBy=multi-user.target" > $HOME/defund.service
# sudo mv $HOME/defund.service /etc/systemd/system
# sudo tee <<EOF >/dev/null /etc/systemd/journald.conf
# Storage=persistent
# EOF
# echo -e '\n\e[42mRunning a service\e[0m\n' && sleep 1
# sudo systemctl restart systemd-journald
# sudo systemctl daemon-reload
# sudo systemctl enable defund
# sudo systemctl restart defund
# echo -e '\n\e[42mCheck node status\e[0m\n' && sleep 1
# if [[ `service defund status | grep active` =~ "running" ]]; then
# echo -e "Your Defund node \e[32minstalled and works\e[39m!"
# echo -e "You can check node status by the command \e[7mservice defund status\e[0m"
# echo -e "Press \e[7mQ\e[0m for exit from status menu"
# else
# echo -e "Your Defund node \e[31mwas not installed correctly\e[39m, please reinstall."
# fi