Skip to main content

Dump Database Command

Export the Watch Tower database as JSON for analysis and debugging. The dump-db command exports the Watch Tower’s internal database state as JSON to standard output. This is useful for debugging, analysis, and data migration.

Usage

watch-tower dump-db --chain-id <chainId> [options]

Options

--chain-id
number
required
Chain ID to dump from the database. This is a required parameter.Example: --chain-id 1 (for Ethereum mainnet) or --chain-id 100 (for Gnosis Chain)
--database-path
string
default:"./database"
Path to the database directory to read from.Environment variable: DATABASE_PATH
--log-level
string
default:"INFO"
Log level for the dump operation. Controls the verbosity of logging output.Environment variable: LOG_LEVEL

Output format

The command outputs JSON to standard output (STDOUT), containing the complete registry state for the specified chain ID. The output includes:
  • Registered conditional orders
  • Order owners and their associated contracts
  • Order execution state and history
  • Chain-specific registry data
The exact structure depends on the internal registry format used by the Watch Tower.

Examples

Basic usage

Dump the database for Ethereum mainnet (chain ID 1):
watch-tower dump-db --chain-id 1

Save to file

Redirect the output to a JSON file:
watch-tower dump-db --chain-id 1 > dump.json

Custom database path

Dump from a database in a custom location:
watch-tower dump-db --chain-id 100 --database-path ./my-database

With debug logging

Enable verbose logging during the dump:
watch-tower dump-db --chain-id 1 --log-level DEBUG

Pretty-print output

Use jq to format the JSON output:
watch-tower dump-db --chain-id 1 | jq .

Environment variables

You can configure the dump using environment variables:
export DATABASE_PATH=./my-database
export LOG_LEVEL=DEBUG

watch-tower dump-db --chain-id 1

Use cases

Debugging

Examine the current state of the Watch Tower’s database to debug issues:
watch-tower dump-db --chain-id 1 | jq '.orders[] | select(.status == "failed")'

Backup

Create a backup of the database state:
watch-tower dump-db --chain-id 1 > backup-$(date +%Y%m%d).json

Analysis

Analyze order execution patterns across different chains:
watch-tower dump-db --chain-id 1 > mainnet.json
watch-tower dump-db --chain-id 100 > gnosis.json
Last modified on March 4, 2026