forked from zscole/canto-node-primer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
77 lines (58 loc) · 2.13 KB
/
setup.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
#!/usr/bin/env bash
set -e
MONIKER="YOUR_MONIKER_HERE"
ENABLE_CORS="true"
ENABLE_REST_API="true"
REST_API_PORT="1317"
PUBLIC_RPC="true"
RPC_PORT="26657"
# === Don't change anything below this line ===
# Checks to see if you've already installed Canto
#
[ -e /$HOME/Canto ] && rm -rf /$HOME/Canto
[ -e /$HOME/.cantod/config/genesis.json ] && rm -rf /$HOME/.cantod/config/genesis.json
# Updates system and installs dependencies
sudo apt-get -y update && sudo apt-get -y upgrade
sudo apt-get install -y git gcc make jq
curl -LO https://go.dev/dl/go1.20.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
source ~/.bashrc
cd /$HOME/
git clone https://github.com/Canto-Network/Canto.git
cd Canto
git checkout v5.0.0
# Installs and builds Canto daemon program
cd $HOME/Canto/cmd/cantod
go install -tags ledger ./...
sudo mv $HOME/go/bin/cantod /usr/bin/
cd $HOME/Canto
make install
# Initializes node
cantod init $MONIKER --chain-id canto_7700-1
# Sets seed node
sed -i 's/seeds = ""/seeds = "[email protected]:15556"/' ~/.cantod/config/config.toml
# Sets service file
sudo cp $HOME/canto-node-primer/canto.service /etc/systemd/system/
# Config Files
if [ "$ENABLE_CORS" = "true" ]; then
sed -i 's/cors_allowed_origins = \[\]/cors_allowed_origins = \["\*"\]/g' /$HOME/.cantod/config/config.toml
fi
if [ "$ENABLE_REST_API" = "true" ]; then
sed -i 's/enable = false/enable = true/g' /$HOME/.cantod/config/app.toml
sed -i 's/address = "tcp:\/\/0.0.0.0:1317"/address = "tcp:\/\/0.0.0.0:'$REST_API_PORT'"/g' /$HOME/.cantod/config/app.toml
fi
if [ "$PUBLIC_RPC" = "true" ]; then
sed -i 's/laddr = "tcp:\/\/127.0.0.1:26657"/c\laddr = "tcp:\/\/0.0.0.0:'$RPC_PORT'"/g' $HOME/.cantod/config/config.toml
fi
# Syncs node
cd $HOME/canto-node-primer
chmod 700 state_sync.sh
./state_sync.sh
mkdir -p $HOME/.cantod/cosmovisor/genesis/bin
mkdir -p $HOME/.cantod/cosmovisor/upgrades
ln -s /usr/bin/cantod $HOME/.cantod/cosmovisor/genesis/bin/cantod
sudo service canto stop
sudo systemctl start canto && journalctl -u canto -f