synctx
Generated by oclif
Sync pending transactions from source to target node. Supports both Besu and Geth clients.
How Does It Work
The tool grabs pending transactions in the txpool for both the source and target node. Then, it compares the pending transactions in both pools to determine which transactions we need to sync, as some transactions are already persisted in the target node. The comparison is performed on the transaction hash. To perform the actual sync, the tool will batch send transactions in groups of 10 (controlled by the --concurrency flag) to help with performance. The batch transactions are sent asynchronously, but the controlling concurrent loop is synchronous.
Install
- Download and extract the zip on the release page. Each release contains multiple distributions. Find the distribution that works for your machine type.
- When unzipping the release contents, a
synctxfolder is extracted, which contains the command line entrypoint inside thebindirectory. - Move the extracted content to a path of your choosing, such as
/usr/local/synctx - Edit your
PATHvariable to include synctx,PATH="$PATH:/usr/local/synctx/binmake sure to persist this change in your.profile|.bash_profile|.zsh_profile - Run
synctx --helpto confirm that the installation has completed successfully.
Docker
As an alternative to downloading the distribution, you can also run the tool via Docker. This builds the distribution
inside the image and exposes synctx as an entrypoint. From there, you may run docker run synctx:latest --help
Building the image can be done with docker build . -t synctx:latest
How To Sync
To sync transactions between nodes, first make sure you have port-forwarded to the necessary Kubernetes services or
pods.
kubectl port-forward {service|pod}/{service_name|pod_name}
Then provide the source and target nodes, where the source node is the node pending transactions will be synced from.
synctx -s http://localhost:8500 -t http://localhost:8501
To perform a dry run and verify if the current nodes are targeted, include the --dry-run flag.
synctx -s http://localhost:8500 -t http://localhost:8501 --dry-run
Ethstats
Local Development
It is highly recommended to read the official docs of oclif as it is used to generate the CLI.
To run the tool against your local changes (without constantly building it), run ./bin/dev.js
Commands
synctx
USAGE
$ synctx -s <value> -t <value> [--dry-run] [--local] [-c <value>]
CONFIG FLAGS
-c, --concurrency=<value> [default: 10] number of concurrent batch requests
--dry-run enable dry run
--local enable local run, provide only forwarded ports
NODE FLAGS
-s, --source=<value> (required) source node to sync from
-t, --target=<value> (required) target node to sync to
EXAMPLES
$ synctx --source=8500 --target=8501 --local
$ synctx --source=http://geth-archive-1:8545 --target=http://geth-validator-1:8545 --concurrency=10
See code: dist/index.ts
synctx help [COMMANDS]
Display help for synctx.
USAGE
$ synctx help [COMMANDS] [-n]
ARGUMENTS
COMMANDS Command to show help for.
FLAGS
-n, --nested-commands Include all nested commands in the output.
DESCRIPTION
Display help for synctx.
See code: @oclif/plugin-help