laconicd-stack/scripts/export-testnet-state.sh
ishavenikar 6733aa7318 Add steps to compress testnet state JSON file (#11)
Part of https://www.notion.so/Create-stacks-for-mainnet-1f2a6b22d4728034be4be2c51decf94e

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: #11
Co-authored-by: ishavenikar <ishavenikar@noreply.git.vdb.to>
Co-committed-by: ishavenikar <ishavenikar@noreply.git.vdb.to>
2025-06-04 11:25:23 +00:00

29 lines
743 B
Bash
Executable File

#!/bin/bash
# Note: Needs to be run in a docker container with image testnet cerc/laconicd:local
# Exit on error
set -e
set -u
# Check args
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <testnet-deployment-dir-absolute>"
exit 1
fi
TESTNET_DEPLOYMENT_DIR="$1"
# Create a temporary target directory
OUTPUT_DIR=${TESTNET_DEPLOYMENT_DIR}/export
mkdir -p $OUTPUT_DIR
# Export state from testnet chain
testnet_state_file="$OUTPUT_DIR/testnet-state.gz"
docker run -it \
-v ${TESTNET_DEPLOYMENT_DIR}/data/laconicd-data:/root/testnet-deployment/.laconicd \
cerc/laconicd:local bash -c "laconicd export --home /root/testnet-deployment/.laconicd" \
| jq | gzip > "$testnet_state_file"
echo "Exported state from testnet to $testnet_state_file"