Installation Guide/
mainnet/
c4e

mainnet
Rpc status: Active

Install Dependencies

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

Install Go

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

Set Variables

echo "export WALLET='wallet'" >> $HOME/.bash_profile
echo "export MONIKER='validator'" >> $HOME/.bash_profile
echo "export PORT_C4E='26'" >> $HOME/.bash_profile
source $HOME/.bash_profile

Build Binary

cd $HOME
rm -rf c4e-chain
git clone https://github.com/chain4energy/c4e-chain
cd c4e-chain
git checkout 1.4.3
make install

c4ed version --long | grep -e version -e commit

Config and Initialize Node

c4ed init "validator" --chain-id perun-1
c4ed config chain-id perun-1
c4ed config keyring-backend os
c4ed config node tcp://localhost:${PORT_C4E}657

Download Genesis and Addrbook

wget -O $HOME/.c4e-chain/config/genesis.json https://download.dteam.tech/c4e/mainnet/genesis
wget -O $HOME/.c4e-chain/config/addrbook.json https://download.dteam.tech/c4e/mainnet/addrbook

Set Seeds and Peers

SEEDS="4c97d663e96a685d02b598dee22323d7a4e569d6@seed.c4e.mainnet.dteam.tech:36656"
PEERS="00eb92db69a4848f8ac1c84e7b8b2d9b01b95dff@peer.c4e.mainnet.dteam.tech:30656,[email protected]:26656,[email protected]:24656,[email protected]:31656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26956,[email protected]:26656,[email protected]:26644,[email protected]:27256,[email protected]:32656,[email protected]:26656,[email protected]:26656,[email protected]:32656,[email protected]:26656,[email protected]:41656,[email protected]:11656,[email protected]:26656,[email protected]:29656,[email protected]:28656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:14656,[email protected]:26656,[email protected]:13456,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:46656,[email protected]:14656,[email protected]:2000,[email protected]:17096,[email protected]:30056,[email protected]:17096,[email protected]:26656,[email protected]:39656,[email protected]:2000,[email protected]:30656,[email protected]:36656,[email protected]:26656,[email protected]:27656,[email protected]:26656,[email protected]:2000,[email protected]:33656,[email protected]:26956,[email protected]:26656,[email protected]:27256,[email protected]:29656,[email protected]:30656"
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.c4e-chain/config/config.toml

Set Custom Ports / Optional

sed -i.bak -e "s%:1317%:${PORT_C4E}317%g;
s%:8080%:${PORT_C4E}080%g;
s%:9090%:${PORT_C4E}090%g;
s%:9091%:${PORT_C4E}091%g;
s%:8545%:${PORT_C4E}545%g;
s%:8546%:${PORT_C4E}546%g;
s%:6065%:${PORT_C4E}065%g" $HOME/.c4e-chain/config/app.toml

sed -i.bak -e "s%:26658%:${PORT_C4E}658%g;
s%:26657%:${PORT_C4E}657%g;
s%:6060%:${PORT_C4E}060%g;
s%:26656%:${PORT_C4E}656%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${PORT_C4E}656\"%;
s%:26660%:${PORT_C4E}660%g" $HOME/.c4e-chain/config/config.toml

Config Pruning / Optional

sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.c4e-chain/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.c4e-chain/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"20\"/" $HOME/.c4e-chain/config/app.toml

Set Minimum Gas Price / Optional

sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "0.01uc4e"|g' $HOME/.c4e-chain/config/app.toml

Disable Indexing / Optional

INDEXER="null"
sed -i -e "s/^indexer *=.*/indexer = \"$INDEXER\"/" $HOME/.c4e-chain/config/config.toml

Disable Snapshots / Optional

SNAPSHOT_INTERVAL=0
sed -i.bak -e "s/^snapshot-interval *=.*/snapshot-interval = \"$SNAPSHOT_INTERVAL\"/" ~/.c4e-chain/config/app.toml

Create Service File

sudo tee /etc/systemd/system/c4ed.service > /dev/null <<EOF
[Unit]
Description=c4e mainnet node
After=network-online.target

[Service]
User=$USER
WorkingDirectory=$HOME/.c4e-chain
ExecStart=$(which c4ed) start
Restart=on-failure
RestartSec=5
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
EOF

Download Snapshot / Optional

c4ed tendermint unsafe-reset-all --home $HOME/.c4e-chain
curl https://download.dteam.tech/c4e/mainnet/pruned/latest-snapshot | lz4 -dc - | tar -xf - -C $HOME/.c4e-chain

Enable and Start Service

sudo systemctl daemon-reload
sudo systemctl enable c4ed
sudo systemctl restart c4ed
sudo journalctl -u c4ed -f -o cat