Skip to content

Commit

Permalink
feat(scripts): mainnet.sh (celestiaorg#3166)
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
rootulp authored Mar 11, 2024
1 parent 1d797b8 commit b731c9e
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions scripts/mainnet.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit b731c9e

Please sign in to comment.