From b731c9ee6853cc762209468ccf8b6e204a55e99c Mon Sep 17 00:00:00 2001 From: Rootul P Date: Mon, 11 Mar 2024 16:57:44 -0400 Subject: [PATCH] feat(scripts): mainnet.sh (#3166) Totally optional PR to add a `mainnet.sh` script that can be used to start a consensus full node on mainnet. I'm using this to try to sync from scratch with a celestia-appd binary built from `main`. Example script output ``` root@rootul-mainnet-consensus:~/celestia-app# ./scripts/mainnet.sh celestia-app home: /root/.celestia-app celestia-app version: 1.0.0-rc0-564-g82703272 Are you sure you want to delete: /root/.celestia-app? [y/n] y Deleting /root/.celestia-app... Initializing config files... Settings seeds in config.toml... Downloading genesis file... Starting celestia-appd in the background and piping logs to mainnet.log You can check the node's status via: celestia-appd status ``` --- scripts/mainnet.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 scripts/mainnet.sh diff --git a/scripts/mainnet.sh b/scripts/mainnet.sh new file mode 100755 index 0000000000..317fe5dbdc --- /dev/null +++ b/scripts/mainnet.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +# Stop script execution if an error is encountered +set -o errexit +# Stop script execution if an undefined variable is used +set -o nounset + +CHAIN_ID="celestia" +NODE_NAME="node-name" +SEEDS="e6116822e1a5e283d8a85d3ec38f4d232274eaf3@consensus-full-seed-1.celestia-bootstrap.net:26656,cf7ac8b19ff56a9d47c75551bd4864883d1e24b5@consensus-full-seed-2.celestia-bootstrap.net:26656" +CELESTIA_APP_HOME="${HOME}/.celestia-app" +CELESTIA_APP_VERSION=$(celestia-appd version 2>&1) + +echo "celestia-app home: ${CELESTIA_APP_HOME}" +echo "celestia-app version: ${CELESTIA_APP_VERSION}" +echo "" + +# Ask the user for confirmation before deleting the existing celestia-app home +# directory. +read -p "Are you sure you want to delete: $CELESTIA_APP_HOME? [y/n] " response + +# Check the user's response +if [ "$response" != "y" ]; then + # Exit if the user did not respond with "y" + echo "You must delete $CELESTIA_APP_HOME to continue." + exit 1 +fi + +echo "Deleting $CELESTIA_APP_HOME..." +rm -r "$CELESTIA_APP_HOME" + +echo "Initializing config files..." +celestia-appd init ${NODE_NAME} --chain-id ${CHAIN_ID} > /dev/null 2>&1 # Hide output to reduce terminal noise + +echo "Settings seeds in config.toml..." +sed -i.bak -e "s/^seeds *=.*/seeds = \"$SEEDS\"/" $CELESTIA_APP_HOME/config/config.toml + +echo "Downloading genesis file..." +celestia-appd download-genesis ${CHAIN_ID} > /dev/null 2>&1 # Hide output to reduce terminal noise + +echo "Starting celestia-appd in the background and piping logs to mainnet.log" +nohup celestia-appd start > "${HOME}/mainnet.log" 2>&1 & + +echo "You can check the node's status via: celestia-appd status"