You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VERSION=v1.1.0 # actual version of binary
sudo apt update && sudo apt upgrade -y
sudo apt install -y curl git jq lz4 build-essential
# Install GO:
wget https://go.dev/dl/go1.19.3.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.19.3.linux-amd64.tar.gz
echo'export GOPATH=/usr/local/go'>>$HOME/.bashrc
echo'export GOBIN=$GOPATH/bin'>>$HOME/.bashrc
echo'export PATH=$PATH:$GOBIN'>>$HOME/.bashrc
source$HOME/.bashrc
# c4ed installation:
git clone https://github.com/chain4energy/c4ed-chain.git &&cd c4ed-chain
git checkout $VERSION
make install
# verify c4ed binary is installed
c4ed version
Create non-root user
addusr c4e
usermod -aG sudo c4e
su - c4e
c4ed configuration
# fill the temp variables. It will be erased after you disconnect from server
ACCOUNT=<># your node moniker
CHAIN=perun-1
RPC=https://rpc.c4e.nodestake.top:443
# init stride home directory
c4ed init $ACCOUNT --chain-id $CHAIN# download genesis
curl $RPC/genesis | jq -r .result.genesis >~/.c4e-chain/config/genesis.json
# set peers
peers=$(curl -s $RPC/net_info | jq -r '.result.peers[] | .node_info.id+"@"+.remote_ip+":"+( .node_info.listen_addr| sub(".*:";"") )'| tr '\n'',')
sed -i "s/persistent_peers =.*/persistent_peers = \"$peers\"/g"~/.c4e-chain/config/config.toml
# configure state-sync
SNAP_RPC=$RPC
LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height); \
BLOCK_HEIGHT=$((LATEST_HEIGHT -2000)); \
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT"| jq -r .result.block_id.hash)echo$LATEST_HEIGHT$BLOCK_HEIGHT$TRUST_HASH
sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"| ; \s|^(seeds[[:space:]]+=[[:space:]]+).*$|\1\"\"|" .c4e-chain/config/config.toml
Run c4ed as a systemd service
sudo tee /etc/systemd/system/c4ed.service > /dev/null <<EOF[Unit]Description=C4E NodeAfter=network-online.target [Service]User=$USERExecStart=$(which c4ed) startRestart=on-failureRestartSec=3LimitNOFILE=4096[Install]WantedBy=multi-user.target EOF
sudo systemctl enable c4ed
sudo systemctl start c4ed
# you can see c4ed logs by running the command:
journalctl -u c4ed -f
Save some usefull variables
cat <<EOF >> ~/.bashrc. <(c4ed completion)# public rpc in case you will need it : ) export RPC=$RPCexport ACCOUNT=$ACCOUNTexport CHAIN=$CHAINEOFsource~/.bashrc