Simplify genesis file setup

This commit is contained in:
Prathamesh Musale 2024-06-18 15:49:39 +05:30
parent 49643309cd
commit f5ceea499a
3 changed files with 15 additions and 15 deletions

View File

@ -6,7 +6,6 @@ services:
environment:
CERC_MONIKER: ${CERC_MONIKER:-TestnetNode}
CERC_CHAIN_ID: ${CERC_CHAIN_ID:-laconic_9000-1}
CERC_GENESIS_FILE_URL: ${CERC_GENESIS_FILE_URL:-file:///root/.laconicd/tmp/genesis.json}
CERC_PEERS: ${CERC_PEERS}
CERC_LOGLEVEL: ${CERC_LOGLEVEL:-info}
volumes:

View File

@ -6,17 +6,20 @@ fi
set -e
input_genesis_file=/root/.laconicd/tmp/genesis.json
if [ ! -f ${input_genesis_file} ]; then
echo "Genesis file not provided, exiting..."
exit 1
fi
if [ -z "$CERC_PEERS" ]; then
echo "Persistent peers not provided, exiting..."
exit 1
else
echo "Using persistent peers $CERC_PEERS"
fi
echo "Env:"
echo "Moniker: $CERC_MONIKER"
echo "Chain Id: $CERC_CHAIN_ID"
echo "Genesis file: $CERC_GENESIS_FILE_URL"
echo "Persistent peers: $CERC_PEERS"
echo "Log level: $CERC_LOGLEVEL"
@ -31,9 +34,8 @@ if [ -z "$(ls -A "$NODE_HOME/data")" ]; then
echo "Initializing a new laconicd node with moniker $CERC_MONIKER and chain id $CERC_CHAIN_ID"
laconicd init $CERC_MONIKER --chain-id=$CERC_CHAIN_ID --home $NODE_HOME
# Fetch genesis config
echo "Fetching genesis file from $CERC_GENESIS_FILE_URL"
curl -o $NODE_HOME/config/genesis.json $CERC_GENESIS_FILE_URL
# Use provided genesis config
cp $input_genesis_file $NODE_HOME/config/genesis.json
else
echo "Node data dir $NODE_HOME/data already exists, skipping initialization..."
fi

View File

@ -67,7 +67,7 @@ Instructions for running a laconicd testnet full node and joining as a validator
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconicd-full-node deploy create --spec-file laconic-full-node-spec.yml --deployment-dir laconic-full-node-deployment
```
* (Optional) Copy over the genesis file (`.json`) to data directory in deployment (`laconic-full-node-deployment/data/laconicd-data/tmp`):
* Copy over the published testnet genesis file (`.json`) to data directory in deployment (`laconic-full-node-deployment/data/laconicd-data/tmp`):
```bash
# Example
@ -92,10 +92,6 @@ Instructions for running a laconicd testnet full node and joining as a validator
# Network chain ID (default: laconic_9000-1)
CERC_CHAIN_ID=
# Genesis file URL
# Not required if a genesis file is placed in the config data directory in previous steps
CERC_GENESIS_FILE_URL=
# Output log level (default: info)
CERC_LOGLEVEL=
```
@ -114,14 +110,17 @@ laconic-so deployment --dir laconic-full-node-deployment start
# With status
docker ps -a
# Check logs for a container
docker logs -f <CONTAINER_ID>
# Get laconicd container id in a variable
LACONICD_CONTAINER_ID=$(docker ps --filter "name=laconicd" -q)
# Check logs for laconicd container
docker logs -f $LACONICD_CONTAINER_ID
```
* Check the sync status of your node:
```bash
docker exec -it <LACONICD_CONTAINER_ID> status | jq .sync_info
docker exec -it $LACONICD_CONTAINER_ID bash -c "laconicd status | jq .sync_info"
```
## Join as testnet validator