docs: update CLI reference in book (#3105)

This commit is contained in:
Thomas Coratger
2023-06-12 18:06:58 +02:00
committed by GitHub
parent 43a2d09462
commit c51a222b26
10 changed files with 702 additions and 191 deletions

View File

@ -10,11 +10,14 @@ reth --help
Some of the most useful commands as a node developer are:
* [`reth node`](./node.md): Starts the Reth node's components, including the JSON-RPC.
* [`reth db`](./db.md): Administrative TUI to the key-value store
* [`reth p2p`](./p2p.md): P2P-related utilities
* [`reth init`](./init.md): Initialize the database from a genesis file.
* [`reth import`](./import.md): This syncs RLP encoded blocks from a file.
* [`reth db`](./db.md): Administrative TUI to the key-value store.
* [`reth stage`](./stage.md): Runs a stage in isolation. Useful for testing and benchmarking.
* [`reth drop-stage`](./drop-stage.md): Drops all the tables associated with a stage. Useful for resetting state.
* [`reth dump-stage`](./dump-stage.md): Dumps all the tables associated with a stage to a new database. Useful for creating snapshots
* [`reth p2p`](./p2p.md): P2P-related utilities
* [`reth test-vectors`](./test-vectors.md): Generate Test Vectors
* [`reth config`](./config.md): Write config to stdout
* [`reth debug`](./debug.md): Various debug routines
See below for the full list of commands.
@ -36,21 +39,15 @@ Commands:
db
Database debugging utilities
stage
Run a single stage
dump-stage
Dumps a stage from a range into a new database
drop-stage
Drops a stage's tables from the database
Manipulate individual stages.
p2p
P2P Debugging utilities
test-chain
Run Ethereum blockchain tests
test-vectors
Generate Test Vectors
config
Write config to stdout
merkle-debug
Debug state root calculation
debug
Various debug routines
help
Print this message or the help of the given subcommand(s)

46
book/cli/config.md Normal file
View File

@ -0,0 +1,46 @@
# `reth config`
Write config to stdout
```bash
$ reth config --help
Usage: reth config [OPTIONS]
Options:
--config <FILE>
The path to the configuration file to use.
--default
Show the default config
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /Users/georgios/Library/Caches/reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: debug]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```

View File

@ -12,6 +12,8 @@ Commands:
Lists all the tables, their entry count and their size
list
Lists the contents of a table
get
Gets the content of a table for the given key
drop
Deletes all database entries
help
@ -80,16 +82,44 @@ Arguments:
The table name
Options:
-s, --start <START>
Where to start iterating
-s, --skip <SKIP>
Skip first N entries
[default: 0]
-r, --reverse <REVERSE>
Reverse the order of the entries. If enabled last table entries are read.
[default: false]
-l, --len <LEN>
How many items to take from the walker
[default: 5]
-j, --json
Dump as JSON instead of using TUI.
-h, --help
Print help (see a summary with '-h')
```
## `reth db get`
```bash
$ reth db get --help
Gets the content of a table for the given key
Usage: reth db get [OPTIONS] <TABLE>
Arguments:
<TABLE>
The table name
Options:
--key
The key to get content for
-h, --help
Print help (see a summary with '-h')
```

173
book/cli/debug.md Normal file
View File

@ -0,0 +1,173 @@
# `reth debug`
```bash
$ reth debug --help
Various debug routines
Usage: reth debug <COMMAND>
Commands:
execution
Debug the roundtrip execution of blocks as well as the generated data.
merkle
Debug the clean & incremental state root calculations.
help
Print this message or the help of the given subcommand(s)
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /Users/georgios/Library/Caches/reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: debug]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
## `reth debug execution`
```bash
$ reth debug execution --help
Debug the roundtrip execution of blocks as well as the generated data.
Usage: reth debug execution [OPTIONS]
Options:
--datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories.
Defaults to the OS-specific data directory:
- Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/`
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
--chain <CHAIN_OR_PATH>
The chain this node is running.
Possible values are either a built-in chain or the path to a chain specification file.
Built-in chains:
- mainnet
- goerli
- sepolia
[default: mainnet]
--debug.tip
Set the chain tip manually for testing purposes.
--to
The maximum block height.
--interval
The block interval for sync and unwind.
[default: 1000]
Networking:
-d, --disable-discovery
Disable the discovery service
--disable-dns-discovery
Disable the DNS discovery
--disable-discv4-discovery
Disable Discv4 discovery
--discovery.port <DISCOVERY_PORT>
The UDP port to use for P2P discovery/networking. default: 30303
--trusted-peers <TRUSTED_PEERS>
Target trusted peer enodes --trusted-peers enode://abcd@192.168.0.1:30303
--trusted-only
Connect only to trusted peers
--bootnodes <BOOTNODES>
Bootnodes to connect to initially.
Will fall back to a network-specific default if not specified.
--peers-file <FILE>
The path to the known peers file. Connected peers are dumped to this file on nodes
shutdown, and read on startup. Cannot be used with `--no-persist-peers`.
--identity <IDENTITY>
Custom node identity
--p2p-secret-key <PATH>
Secret key to use for this node.
This will also deterministically set the peer ID. If not specified, it will be set in the data dir for the chain being used.
--no-persist-peers
Do not persist peers.
--nat <NAT>
NAT resolution method
[default: any]
--port <PORT>
Network listening port. default: 30303
```
## `reth debug merkle`
```bash
$ reth debug merkle --help
Debug the clean & incremental state root calculations.
Usage: reth debug merkle [OPTIONS]
Options:
--datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories.
Defaults to the OS-specific data directory:
- Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/`
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
--chain <CHAIN_OR_PATH>
The chain this node is running.
Possible values are either a built-in chain or the path to a chain specification file.
Built-in chains:
- mainnet
- goerli
- sepolia
[default: mainnet]
--to
The height to finish at
--skip-node-depth
The depth after which we should start comparing branch nodes
```

View File

@ -1,16 +1,14 @@
# reth drop-stage
# `reth import`
```bash
$ reth drop-stage --help
Drops a stage's tables from the database
$ reth import --help
Usage: reth drop-stage [OPTIONS] <STAGE>
Arguments:
<STAGE>
[possible values: headers, bodies, senders, execution, hashing, merkle, tx-lookup, history]
Usage: reth import [OPTIONS]
Options:
--config <FILE>
The path to the configuration file to use.
--datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories.
@ -20,12 +18,6 @@ Options:
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
--db <PATH>
The path to the database folder. If not specified, it will be set in the data dir for the
chain being used.
--chain <CHAIN_OR_PATH>
The chain this node is running.
@ -38,8 +30,11 @@ Options:
[default: mainnet]
-h, --help
Print help (see a summary with '-h')
--path <IMPORT_PATH>
The path to a block file for import.
The online stages (headers and bodies) are replaced by a file import, after which the
remaining stages are executed.
Logging:
--log.persistent

View File

@ -1,22 +1,9 @@
# `reth dump-stage`
# `reth init`
```bash
$ reth dump-stage --help
Dumps a stage from a range into a new database
$ reth init --help
Usage: reth dump-stage [OPTIONS] <COMMAND>
Commands:
execution
Execution stage
storage-hashing
StorageHashing stage
account-hashing
AccountHashing stage
merkle
Merkle stage
help
Print this message or the help of the given subcommand(s)
Usage: reth init [OPTIONS]
Options:
--datadir <DATA_DIR>
@ -28,12 +15,6 @@ Options:
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
--db <PATH>
The path to the database folder. If not specified, it will be set in the data dir for the
chain being used.
--chain <CHAIN_OR_PATH>
The chain this node is running.
@ -46,9 +27,6 @@ Options:
[default: mainnet]
-h, --help
Print help (see a summary with '-h')
Logging:
--log.persistent
The flag to enable persistent logs
@ -78,5 +56,4 @@ Display:
-q, --quiet
Silence all log output
```

View File

@ -24,11 +24,6 @@ Options:
--config <FILE>
The path to the configuration file to use.
--p2p-secret-key <PATH>
Secret key to use for this node.
This will also deterministically set the peer ID. If not specified, it will be set in the data dir for the chain being used.
--chain <CHAIN_OR_PATH>
The chain this node is running.
@ -41,6 +36,9 @@ Options:
[default: mainnet]
--auto-mine
Automatically mine blocks for new transactions
-h, --help
Print help (see a summary with '-h')
@ -78,6 +76,14 @@ Networking:
The path to the known peers file. Connected peers are dumped to this file on nodes
shutdown, and read on startup. Cannot be used with `--no-persist-peers`.
--identity <IDENTITY>
Custom node identity
--p2p-secret-key <PATH>
Secret key to use for this node.
This will also deterministically set the peer ID. If not specified, it will be set in the data dir for the chain being used.
--no-persist-peers
Do not persist peers.
@ -135,8 +141,48 @@ Rpc:
--authrpc.jwtsecret <PATH>
Path to a JWT secret to use for authenticated RPC endpoints
--auto-mine
Automatically mine blocks for new transactions
--rpc-max-request-size
Set the maximum RPC request payload size for both HTTP and WS in megabytes.
--rpc-max-response-size
Set the maximum RPC response payload size for both HTTP and WS in megabytes.
--rpc-max-subscriptions-per-connection
Set the the maximum concurrent subscriptions per connection.
--rpc-max-connections
Maximum number of RPC server connections.
--rpc-max-tracing-requests
Maximum number of concurrent tracing requests.
--gas-price-oracle
Gas price oracle configuration.
--block-cache-size
Max size for cached block data in megabytes.
--receipt-cache-size
Max size for cached receipt data in megabytes.
--env-cache-size
Max size for cached evm env data in megabytes.
Builder:
--builder.extradata
Block extra data set by the payload builder.
--builder.gaslimit
Target gas ceiling for built blocks.
--builder.interval
The interval at which the job should build a new payload after the last (in seconds).
--builder.deadline
The deadline for when the payload builder job should resolve.
--builder.max-tasks
Maximum number of tasks to spawn for building a payload.
Debug:
--debug.continuous

View File

@ -112,20 +112,11 @@ Display:
$ reth p2p header --help
Download block header
Usage: reth p2p header [OPTIONS] <ID>
Usage: reth p2p header <ID>
Arguments:
<ID>
The header number or hash
Options:
--p2p-secret-key <PATH>
Secret key to use for this node.
This also will deterministically set the peer ID.
-h, --help
Print help (see a summary with '-h')
```
@ -136,18 +127,9 @@ Options:
$ reth p2p body --help
Download block body
Usage: reth p2p body [OPTIONS] <ID>
Usage: reth p2p body <ID>
Arguments:
<ID>
The block number or hash
Options:
--p2p-secret-key <PATH>
Secret key to use for this node.
This also will deterministically set the peer ID.
-h, --help
Print help (see a summary with '-h')
```

View File

@ -1,15 +1,68 @@
# `reth stage`
```bash
$ reth stage --help
Usage: reth db <COMMAND>
Commands:
run
Run a single stage.
Usage: reth stage [OPTIONS] --from <FROM> --to <TO> <STAGE>
Note that this won't use the Pipeline and as a result runs stages
assuming that all the data can be held in memory. It is not recommended
to run a stage for really large block ranges if your computer does not have
a lot of memory to store all the data.
drop
Drop a stage's tables from the database.
dump
Dumps a stage from a range into a new database.
unwind
Unwinds a certain block range, deleting it from the database.
help
Print this message or the help of the given subcommand(s)
Arguments:
<STAGE>
The name of the stage to run
Logging:
--log.persistent
The flag to enable persistent logs
[possible values: headers, bodies, senders, execution, hashing, merkle, tx-lookup, history]
--log.directory <PATH>
The path to put log files in
[default: /Users/georgios/Library/Caches/reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: debug]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
## `reth stage run`
```bash
Usage: reth stage run [OPTIONS] --from <FROM> --to <TO> --stage <STAGE>
Run a single stage.
Note that this won't use the Pipeline and as a result runs stages
assuming that all the data can be held in memory. It is not recommended
to run a stage for really large block ranges if your computer does not have
a lot of memory to store all the data.
Options:
--config <FILE>
@ -38,27 +91,35 @@ Options:
[default: mainnet]
--p2p-secret-key <PATH>
Secret key to use for this node.
This also will deterministically set the peer ID.
--metrics <SOCKET>
Enable Prometheus metrics.
The metrics will be served at the given interface and port.
--stage <STAGE>
The name of the stage to run
[possible values: headers, bodies, senders, execution, account-hashing, storage-hashing, hashing, merkle, tx-lookup, history, account-history, storage-history, total-difficulty]
--from <FROM>
The height to start at
-t, --to <TO>
The end of the stage
--batch-size
Batch size for stage execution and unwind
-s, --skip-unwind
Normally, running the stage requires unwinding for stages that already have been run, in order to not rewrite to the same database slots.
You can optionally skip the unwinding phase if you're syncing a block range that has not been synced before.
--commit
Commits the changes in the database. WARNING: potentially destructive.
Useful when you want to run diagnostics on the database.
-h, --help
Print help (see a summary with '-h')
@ -90,6 +151,15 @@ Networking:
The path to the known peers file. Connected peers are dumped to this file on nodes
shutdown, and read on startup. Cannot be used with `--no-persist-peers`.
--identity
Custom node identity
--p2p-secret-key
Secret key to use for this node.
This will also deterministically set the peer ID. If not specified, it will be set in the
data dir for the chain being used.
--no-persist-peers
Do not persist peers.
@ -100,35 +170,214 @@ Networking:
--port <PORT>
Network listening port. default: 30303
Logging:
--log.persistent
The flag to enable persistent logs
--log.directory <PATH>
The path to put log files in
[default: /Users/georgios/Library/Caches/reth/logs]
--log.journald
Log events to journald
--log.filter <FILTER>
The filter to use for logs written to the log file
[default: debug]
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
-vvvv Debug
-vvvvv Traces (warning: very verbose!)
-q, --quiet
Silence all log output
```
## `reth stage drop`
```bash
Usage: reth stage drop [OPTIONS] <STAGE>
Drop a stage's tables from the database.
Arguments:
<STAGE>
The name of the stage to drop
[possible values: headers, bodies, senders, execution, account-hashing, storage-hashing, hashing, merkle, tx-lookup, history, account-history, storage-history, total-difficulty]
Options:
--datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories.
Defaults to the OS-specific data directory:
- Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/`
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
--chain <CHAIN_OR_PATH>
The chain this node is running.
Possible values are either a built-in chain or the path to a chain specification file.
Built-in chains:
- mainnet
- goerli
- sepolia
[default: mainnet]
```
## `reth stage dump`
```bash
Usage: reth stage dump [OPTIONS] <COMMAND>
Dumps a stage from a range into a new database.
Commands:
execution
Execution stage.
storage-hashing
StorageHashing stage.
account-hashing
AccountHashing stage.
merkle
Merkle stage.
help
Print this message or the help of the given subcommand(s)
Options:
--datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories.
Defaults to the OS-specific data directory:
- Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/`
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
--chain <CHAIN_OR_PATH>
The chain this node is running.
Possible values are either a built-in chain or the path to a chain specification file.
Built-in chains:
- mainnet
- goerli
- sepolia
[default: mainnet]
```
### `reth stage dump execution`
```bash
Usage: reth stage dump execution [OPTIONS]
Execution stage.
Options:
--output_db <OUTPUT_PATH>
The path to the new database folder.
-f, --from <FROM>
From which block.
-t, --to <TO>
To which block.
-d, --dry-run <DRY_RUN>
If passed, it will dry-run a stage execution from the newly created database right after
dumping.
[default: false]
```
### `reth stage dump storage-hashing`
```bash
Usage: reth stage dump storage-hashing [OPTIONS]
StorageHashing stage.
Options:
--output_db <OUTPUT_PATH>
The path to the new database folder.
-f, --from <FROM>
From which block.
-t, --to <TO>
To which block.
-d, --dry-run <DRY_RUN>
If passed, it will dry-run a stage execution from the newly created database right after
dumping.
[default: false]
```
### `reth stage dump account-hashing`
```bash
Usage: reth stage dump account-hashing [OPTIONS]
AccountHashing stage.
Options:
--output_db <OUTPUT_PATH>
The path to the new database folder.
-f, --from <FROM>
From which block.
-t, --to <TO>
To which block.
-d, --dry-run <DRY_RUN>
If passed, it will dry-run a stage execution from the newly created database right after
dumping.
[default: false]
```
### `reth stage dump merkle`
```bash
Usage: reth stage dump merkle [OPTIONS]
Merkle stage.
Options:
--output_db <OUTPUT_PATH>
The path to the new database folder.
-f, --from <FROM>
From which block.
-t, --to <TO>
To which block.
-d, --dry-run <DRY_RUN>
If passed, it will dry-run a stage execution from the newly created database right after
dumping.
[default: false]
```
## `reth stage unwind`
```bash
Usage: reth stage unwind [OPTIONS] <COMMAND>
Unwinds a certain block range, deleting it from the database.
Commands:
to-block
Unwinds the database until the given block number (range is inclusive).
num-blocks
Unwinds the given number of blocks from the database.
help
Print this message or the help of the given subcommand(s)
Options:
--datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories.
Defaults to the OS-specific data directory:
- Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/`
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`
[default: default]
--chain <CHAIN_OR_PATH>
The chain this node is running.
Possible values are either a built-in chain or the path to a chain specification file.
Built-in chains:
- mainnet
- goerli
- sepolia
[default: mainnet]
```

16
book/cli/test-vectors.md Normal file
View File

@ -0,0 +1,16 @@
# `reth test-vectors`
```bash
$ reth test-vectors --help
Generate Test Vectors
Usage: reth test-vectors <COMMAND> <NAMES>
Commands:
tables
Generates test vectors for specified tables. If no table is specified, generate for all.
Arguments:
<NAMES>
List of table names. Case-sensitive.
```