sudo apt update
sudo apt install curl iptables build-essential git wget jq make gcc nano tmux htop nvme-cli pkg-config libssl-dev libleveldb-dev tar clang bsdmainutils ncdu unzip libleveldb-dev lz4 -y
cd $HOME && \
ver="1.22.6" && \
wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz" && \
sudo rm -rf /usr/local/go && \
sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz" && \
rm "go$ver.linux-amd64.tar.gz" && \
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile && \
source $HOME/.bash_profile && \
go version
go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@latest
echo "export WALLET='wallet'" >> $HOME/.bash_profile
echo "export MONIKER='validator'" >> $HOME/.bash_profile
echo "export PORT_INJECTIVE='26'" >> $HOME/.bash_profile
source $HOME/.bash_profile
cd $HOME
git clone https://github.com/InjectiveFoundation/injective-core
cd injective-core
git fetch --tags
git checkout $(git tag -l "v1.14.0*" | sort -V | tail -n 1)
make install
injectived version
injectived config set client keyring-backend os
injectived config set client node tcp://localhost:${PORT_INJECTIVE}657
injectived config set client chain-id injective-1
injectived init "validator" --chain-id injective-1
# Create Cosmovisor folders
mkdir -p $HOME/.injectived/cosmovisor/genesis/bin
mkdir -p $HOME/.injectived/cosmovisor/upgrades
# Copy binary to Cosmovisor folder
cp $HOME/go/bin/injectived $HOME/.injectived/cosmovisor/genesis/bin
wget -O $HOME/.injectived/config/genesis.json https://download.dteam.tech/injective/mainnet/genesis
wget -O $HOME/.injectived/config/addrbook.json https://download.dteam.tech/injective/mainnet/addrbook
SEEDS="734defa75d2e0d090d6da0ee250a775aaec741ef@seed.injective.mainnet.dteam.tech:46656"
PEERS="3890067a5bf9276349c5e803eb4f5ca3454af7eb@peer.injective.mainnet.dteam.tech:27656,27bc6d3cde19ae5b18713d2ea903d9530461393f@2a01:26656,[email protected]:26656,[email protected]:26250,[email protected]:27656,[email protected]:26656,[email protected]:14356,[email protected]:26250,[email protected]:26656,[email protected]:26250,[email protected]:26656,[email protected]:14356,[email protected]:26656,[email protected]:26250,[email protected]:26656,[email protected]:26250,[email protected]:11751,[email protected]:26656,[email protected]:26656,[email protected]:26250,[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]:26250,[email protected]:26656,[email protected]:26656,[email protected]:35656,[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,[email protected]:26648,[email protected]:26656,[email protected]:14356,[email protected]:14356,[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]:27656,[email protected]:26656,[email protected]:26656,[email protected]:12200,[email protected]:26656,[email protected]:26656,[email protected]:14356,[email protected]:26656,[email protected]:32600,[email protected]:26656,[email protected]:26656,[email protected]:26656"
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.injectived/config/config.toml
sed -i.bak -e "s%:1317%:${PORT_INJECTIVE}317%g;
s%:8080%:${PORT_INJECTIVE}080%g;
s%:9090%:${PORT_INJECTIVE}090%g;
s%:9091%:${PORT_INJECTIVE}091%g;
s%:8545%:${PORT_INJECTIVE}545%g;
s%:8546%:${PORT_INJECTIVE}546%g;
s%:6065%:${PORT_INJECTIVE}065%g" $HOME/.injectived/config/app.toml
sed -i.bak -e "s%:26658%:${PORT_INJECTIVE}658%g;
s%:26657%:${PORT_INJECTIVE}657%g;
s%:6060%:${PORT_INJECTIVE}060%g;
s%:26656%:${PORT_INJECTIVE}656%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${PORT_INJECTIVE}656\"%;
s%:26660%:${PORT_INJECTIVE}660%g" $HOME/.injectived/config/config.toml
sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.injectived/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.injectived/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"20\"/" $HOME/.injectived/config/app.toml
sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "160000000inj"|g' $HOME/.injectived/config/app.toml
INDEXER="null"
sed -i -e "s/^indexer *=.*/indexer = \"$INDEXER\"/" $HOME/.injectived/config/config.toml
SNAPSHOT_INTERVAL=0
sed -i.bak -e "s/^snapshot-interval *=.*/snapshot-interval = \"$SNAPSHOT_INTERVAL\"/" ~/.injectived/config/app.toml
sudo tee /etc/systemd/system/injectived.service > /dev/null <<EOF
[Unit]
Description="injective mainnet node"
After=network-online.target
[Service]
User=$USER
ExecStart=$HOME/go/bin/cosmovisor run start --home "$HOME/.injectived"
Restart=always
RestartSec=3
LimitNOFILE=4096
Environment="DAEMON_NAME=injectived"
Environment="DAEMON_HOME=$HOME/.injectived"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="UNSAFE_SKIP_BACKUP=true"
[Install]
WantedBy=multi-user.target
EOF
injectived tendermint unsafe-reset-all --home $HOME/.injectived
curl https://download.dteam.tech/injective/mainnet/pruned/latest-snapshot | lz4 -dc - | tar -xf - -C $HOME/.injectived
sudo systemctl daemon-reload
sudo systemctl enable injectived
sudo systemctl restart injectived
sudo journalctl -u injectived -f -o cat