c4e-icon

Installation Chain4Energy

Guide Installation Chain4Energy

Binary Info

github link: https://github.com/chain4energy/c4e-chain
app name: c4ed
version: v1.3.1
cosmos sdk version: v0.46.13
git commit: 55fe5c3c1a1b9a8489d39e765413315c5b61c4f7
  • Update and Install dependencies:
    sudo apt update
    sudo apt upgrade -y
    sudo apt install git build-essential curl jq -y
  • Installing Go:
    ver="1.21.5"
    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 version 1.21.5 ...
  • Install cosmovisor v1.5.0 ( recommended ):
    go install cosmossdk.io/tools/cosmovisor/cmd/[email protected]
  • Install app:
    cd $HOME
    git clone https://github.com/chain4energy/c4e-chain c4e 
    cd c4e
    git checkout 55fe5c3c1a1b9a8489d39e765413315c5b61c4f7
    make install
    
  • Initialize node:
    change "NODE_NAME" according to your moniker / node name
    c4ed init NODE_NAME --chain-id perun-1 --home $HOME/.c4e-chain
  • Config node ( optional ):
    this will change your client.toml value
    c4ed config chain-id perun-1
    c4ed config keyring-backend file
    c4ed config node tcp://localhost:26657
  • Configure cosmovisor:
    cd $HOME
    export DAEMON_NAME=c4ed
    export DAEMON_HOME=$HOME/.c4e-chain
    cosmovisor init $(which c4ed)
  • Download genesis and addrbook file:
    wget -O $HOME/.c4e-chain/config/genesis.json "https://snapshot-at-1.genznodes.dev/c4e/genesis.json"
    wget -O $HOME/.c4e-chain/config/addrbook.json "https://snapshot-at-1.genznodes.dev/c4e/addrbook.json"
  • Using our node snapshot / statesync ( if needed )
    See detail in page
    snapshot page
    statesync page
  • Set service files:
    sudo tee /etc/systemd/system/c4ed.service > /dev/null <<EOF
    [Unit]
    Description="Chain4Energy daemon node"
    After=network-online.target
    
    [Service]
    User=$USER
    Environment="DAEMON_NAME=c4ed"
    Environment="DAEMON_HOME=$HOME/.c4e-chain"
    Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"
    Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
    Environment="UNSAFE_SKIP_BACKUP=true"
    Environment="DAEMON_PREUPGRADE_MAX_RETRIES=0"
    Environment="DAEMON_LOG_BUFFER_SIZE=512"
    ExecStart=$(which cosmovisor) run start
    Restart=always
    RestartSec=3
    LimitNOFILE=65535
    
    [Install]
    WantedBy=multi-user.target
    EOF
  • Launch nodes:
    sudo systemctl daemon-reload
    sudo systemctl enable c4ed
    sudo systemctl start c4ed
    journalctl -fu c4ed -o cat
  • Troubleshooting

    1. Error: binary not present

  • If you see logs like this, pay attention to [UPGRADE_NAME] :
    Error: binary not present
    stat $HOME/.c4e-chain/cosmovisor/upgrades/[UPGRADE_NAME]/bin/c4ed: no such file or directory"
    c4ed.service: Main process exited, code=exited, status=1/FAILURE
    c4ed.service: Failed with result 'exit-code'.
  • Fix with:
    Make sure you change [UPGRADE_NAME] according to your logs
    export DAEMON_NAME=c4ed
    export DAEMON_HOME=$HOME/.c4e-chain
    cosmovisor add-upgrade [UPGRADE_NAME] $(which c4ed)
  • Check node logs:
    journalctl -fu c4ed -o cat