laconicd-stack/scripts/export-testnet-state.sh

29 lines
760 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.json"
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 .app_state.onboarding > "$testnet_state_file"
echo "Exported state from testnet to $testnet_state_file"