laconicd-stack/scripts/export-testnet-state.sh
shreerang 1154cfd0bc Add stack to run mainnet validator node (#1)
Part of https://www.notion.so/Laconic-Mainnet-Plan-1eca6b22d47280569cd0d1e6d711d949

Co-authored-by: Shreerang Kale <shreerangkale@gmail.com>
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
Reviewed-on: #1
Co-authored-by: shreerang <shreerang@noreply.git.vdb.to>
Co-committed-by: shreerang <shreerang@noreply.git.vdb.to>
2025-05-15 06:38:42 +00:00

29 lines
738 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 > "$testnet_state_file"
echo "Exported state from testnet to $testnet_state_file"