From 59ff415fdb42c8ce0bf7b1bfa11f58c8d3032b61 Mon Sep 17 00:00:00 2001 From: Claude Agent Date: Fri, 19 Jun 2026 09:35:50 +0000 Subject: [PATCH] cronos: add mainnet EVM chain (chain-id 25) as client-type node Add cronosd cometbft.Dockerfile and init.sh for Cronos EVM mainnet. - Dockerfile: layer cometbft-common.sh + init.sh onto upstream cronos image - init.sh: adapted from haqq pattern with EVM JSON-RPC on 8545, WS on 8546, CometBFT RPC on 26657, P2P on 10521, chain-id cronosmainnet_25-1 - Statesync via ct_configure_statesync, genesis from official repo - Pruning: custom with keep-recent=100, interval=19 Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe --- cronos/cometbft.Dockerfile | 11 ++++++ cronos/scripts/init.sh | 69 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 cronos/cometbft.Dockerfile create mode 100644 cronos/scripts/init.sh diff --git a/cronos/cometbft.Dockerfile b/cronos/cometbft.Dockerfile new file mode 100644 index 00000000..ee2752f7 --- /dev/null +++ b/cronos/cometbft.Dockerfile @@ -0,0 +1,11 @@ +ARG CRONOS_CRONOS_IMAGE +ARG CRONOS_CRONOS_VERSION +FROM ${CRONOS_CRONOS_IMAGE}:${CRONOS_CRONOS_VERSION} +# Layer the shared CometBFT bootstrap lib + the chain init.sh onto the upstream +# cronos binary image (alpine-based, has sh+apk; runs nonroot by default — the compose +# sets user: root so init.sh can apk-add curl and write the /root home). +USER root +COPY ./scripts/cometbft-common.sh /usr/local/bin/cometbft-common.sh +COPY ./scripts/init.sh /usr/local/bin/init.sh +RUN chmod +x /usr/local/bin/init.sh /usr/local/bin/cometbft-common.sh +ENTRYPOINT ["init.sh"] diff --git a/cronos/scripts/init.sh b/cronos/scripts/init.sh new file mode 100644 index 00000000..4be329c3 --- /dev/null +++ b/cronos/scripts/init.sh @@ -0,0 +1,69 @@ +#!/bin/sh + +set -e # Exit on failure + +echo "MONIKER: $MONIKER" + +CHAINID=${CHAINID:-cronosmainnet_25-1} +CHAINNAME=${CHAINNAME:-mainnet} +API=${API:-eth,txpool,net,debug,web3} + +CONFIG_DIR="/root/.cronos/config" + +# Create config directory +mkdir -p "$CONFIG_DIR" + +P2P_STRING="tcp:\/\/0\.0\.0\.0\:${P2P_PORT:-10521}" +NAT_STRING="${IP}:${P2P_PORT:-10521}" + +env + +# this goes first because it won't overwrite shit +apk add curl jq +if [ $? -ne 0 ]; then exit 1; fi + +# Source the shared CometBFT helpers +. /usr/local/bin/cometbft-common.sh + +if cronosd init ${MONIKER} --chain-id ${CHAINID} --home /root/.cronos/; then + # Define variables + GENESIS_URL="https://raw.githubusercontent.com/crypto-org-chain/cronos-mainnet/master/cronosmainnet_25-1/genesis.json" + SEEDS="0d5cf1394a1cfde28dc8f023567222abc0f47534@cronos-seed-0.crypto.org:26656,3032073adc06d710dd512240281637c1bd0c8a7b@cronos-seed-1.crypto.org:26656,04f43116b4c6c70054d9c2b7485383df5b1ed1da@cronos-seed-2.crypto.org:26656" + + # Download config files + curl -sL "$GENESIS_URL" -o "$CONFIG_DIR/genesis.json" + + # somehow it's better to make home static to /root + sed -i 's|~/|/root/|g' "$CONFIG_DIR/config.toml" + sed -i 's|~/|/root/|g' "$CONFIG_DIR/app.toml" +else + echo "Already initialized, continuing!" >&2 +fi + +# Localize home directory paths +ct_localize_home /root/.cronos/config + +# apply a port change to the config +ct_patch_p2p "$CONFIG_DIR/config.toml" "$IP" "${P2P_PORT:-10521}" + +sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $CONFIG_DIR/app.toml +sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $CONFIG_DIR/app.toml +sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"19\"/" $CONFIG_DIR/app.toml +sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $CONFIG_DIR/config.toml + +sed -i "/^\[json-rpc\]/,/^\[/{s|^address = .*|address = \"0.0.0.0:8545\"|}" "$CONFIG_DIR/app.toml" +sed -i "/^\[json-rpc\]/,/^\[/{s|^ws-address = .*|ws-address = \"0.0.0.0:8546\"|}" "$CONFIG_DIR/app.toml" +sed -i "/^\[json-rpc\]/,/^\[/{s|^api = .*|api = \"$API\"|}" "$CONFIG_DIR/app.toml" + +# Set seeds +ct_set_persistent_peers "$CONFIG_DIR/config.toml" "$SEEDS" + +# Configure state sync using official RPC endpoints +ct_configure_statesync "$CONFIG_DIR/config.toml" "https://rpc-cronos.crypto.org:443,https://cronos-rpc.publicnode.com:443" 2000 + +# Update moniker if set +if [ -n "$MONIKER" ] && [ -f "$CONFIG_DIR/config.toml" ]; then + ct_set_moniker "$CONFIG_DIR/config.toml" "$MONIKER" +fi + +exec cronosd start --chain-id ${CHAINID} $@ -- 2.49.1