-
Notifications
You must be signed in to change notification settings - Fork 7
/
Wrapperinstall.sh
115 lines (95 loc) · 3.98 KB
/
Wrapperinstall.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
113
114
115
#! /bin/bash
sudo apt update
REQUIRED_PKG="jq"
PKG_OK=$(dpkg-query -W --showformat='${Status}\n' $REQUIRED_PKG|grep "install ok installed")
echo Checking for $REQUIRED_PKG: $PKG_OK
if [ "" = "$PKG_OK" ]; then
echo "No $REQUIRED_PKG. Setting up $REQUIRED_PKG."
sudo apt-get --yes install $REQUIRED_PKG
fi
REQUIRED_PKG="liblz4-tool"
PKG_OK=$(dpkg-query -W --showformat='${Status}\n' $REQUIRED_PKG|grep "install ok installed")
echo Checking for $REQUIRED_PKG: $PKG_OK
if [ "" = "$PKG_OK" ]; then
echo "No $REQUIRED_PKG. Setting up $REQUIRED_PKG."
sudo apt-get --yes install $REQUIRED_PKG
fi
denom=uaxl
if [ -z $MONIKER ]; then
echo "Please enter Moniker name below"
read -p "Enter Moniker name :" MONIKER
fi
if [ -z "$NETWORK" ];then
read -p "Enter network, testnet or mainnet :" NETWORK
fi
read -p "Enter your KEYRING PASSWORD : " KEYRING
# Determining Axelar versions
echo "Determining Axelar version"
CORE_VERSION=$(curl -s https://raw.githubusercontent.com/axelarnetwork/axelar-docs/main/pages/resources/$NETWORK.md | grep axelar-core | cut -d \` -f 4)
echo ${CORE_VERSION}
echo "Determining Tofnd version"
TOFND_VERSION=$(curl -s https://raw.githubusercontent.com/axelarnetwork/axelar-docs/main/pages/resources/$NETWORK.md | grep tofnd | cut -d \` -f 4)
echo ${TOFND_VERSION}
echo
if [ "$NETWORK" == testnet ]; then
echo "Setup node for axelar testnet"
echo "Determining testnet chain"
CHAIN_ID=$(curl -s https://raw.githubusercontent.com/axelarnetwork/axelarate-community/main/scripts/node.sh | grep chain_id=axelar-t | cut -f2 -d "=")
NETWORKPATH=".axelar_testnet"
SNAPSHOTURL=$(curl https://quicksync.io/axelar.json|jq -r '.[] |select(.file=="axelartestnet-lisbon-3-pruned")|.url')
SNAPSHOTFILE=$(curl https://quicksync.io/axelar.json|jq -r '.[] |select(.file=="axelartestnet-lisbon-3-pruned")|.url' | cut -c26-)
else
echo "Setup node for axelar mainnet"
echo "Determining mainnet chain"
CHAIN_ID=$(curl -s https://raw.githubusercontent.com/axelarnetwork/axelarate-community/main/scripts/node.sh | grep chain_id=axelar-d | cut -f2 -d "=")
NETWORKPATH=".axelar"
SNAPSHOTURL=$(curl https://quicksync.io/axelar.json|jq -r '.[] |select(.file=="axelar-dojo-1-default")|.url')
SNAPSHOTFILE=$(curl https://quicksync.io/axelar.json|jq -r '.[] |select(.file=="axelar-dojo-1-default")|.url' | cut -c26-)
fi
echo "Clone Axerlar Community Github"
# Remove repo for a clean git clone
sudo rm -rf ~/axelarate-community/
cd ~
git clone https://github.com/axelarnetwork/axelarate-community.git >/dev/null 2>&1
cd ~/axelarate-community
echo "done"
echo
echo "make directory"
mkdir $HOME/$NETWORKPATH/
mkdir $HOME/$NETWORKPATH/.core/
echo "done"
echo
echo "Adding external ip to config file"
public_ip=$(curl -s ifconfig.me)
echo "See your public IP: $public_ip, this will be used to update config.toml"
read -p "Press enter to continue, or type ENTERIP to reenter a new one: " reenterip
if [ ! -z $reenterip ] && [ $reenterip == "ENTERIP" ]; then
read -p "Enter your public ip : " public_ip
test='([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])'
while [[ !($public_ip =~ ^$test\.$test\.$test\.$test$) ]]; do
read -p "invalid ip, pleeas re-enter : " public_ip
done
fi
echo "Final public ip used is $public_ip"
sed -i "s/external_address = \"\"/external_address = \"$public_ip:26656\"/" $HOME/axelarate-community/configuration/config.toml
echo "done"
echo
echo "downloading snapshot file"
cd $HOME/$NETWORKPATH/.core/
wget $SNAPSHOTURL
echo "remove any old data"
rm -rf $HOME/$NETWORKPATH/data
echo "extracting the data"
lz4 -d $SNAPSHOTFILE | tar xf -
rm $SNAPSHOTFILE
echo "done"
echo
echo "starting axelar-core"
cd ~/axelarate-community
KEYRING_PASSWORD=$KEYRING ./scripts/node.sh -a $CORE_VERSION -n $NETWORK
echo "Node setup done"
echo "Please fund validator address and wait for the node to be fully synced"
validator=$(tail $HOME/$NETWORKPATH/validator.txt | grep address | cut -f2 -d ":")
echo "validator adress is : $validator"
echo "If you want to run a validator please choose option 5"
echo "done"