Command Line Interface
Command line (CLI) arguments are arguments specified after the RSK start
class. See Config Options
New entry points (Java classes with static public main method) have been included from the RSK Hop Release v4.3.0.
The CLI arguments have two forms; the parameter and the flag:
- Parameter
- Has a name and an associated value, separated by a space
- Starts with a dash
- Flag
- It's a single text, without spaces
- Starts with a double dash
Find below a list of CLI flags and parameters available:
Parameters and Flags
Network related
The following CLI flags determine which network the Rootstock (RSK) node will connect to.
--main
: This indicates that the configuration for the Rootstock Mainnet (public network) should be used.--testnet
: This indicates that the configuration for the Rootstock Testnet (public network) should be used.--regtest
: This indicates that the configuration for the Rootstock Regtest (localhost network) should be used.- Example:
java -cp rsk-core-<VERSION>.jar co.rsk.start --regtest
- Example:
- Only one of these three CLI flags should be specified.
- When none of these are specified, Rootstock Mainnet is used by default.
Database related
The Rootstock (RSK) node stores transactions, blocks, and other blockchain state on disk. This is known as the Blockchain Database.
-
--reset
: This indicates that the block database should be erased, and should start from scratch, i.e. from genesis block. This is typically expected to be used when connecting to Rootstock Regtest, or in select debugging scenarios. It is also used when switching between different databases, e.g. betweenleveldb
androcksdb
. -
--import
: This indicates that the block database should be imported from an external source. This is typically expected to be used when connecting to Rootstock Testnet or Rootstock Mainnet, and when a reduction in "initial sync time" is desired. It is also used when switching between different databases, e.g. betweenleveldb
androcksdb
.
Configuration related
--verify-config
: This indicates that the configuration file used by this run of the Rootstock node should be validated. By default this step is always performed.--print-system-info
: This indicates that the system information of the computer that the Rootstock node is running on should be output. By default, this is always output.--skip-java-check
: This indicates that the detection of the version of the Java Virtual Machine that the Rootstock node is running in is supported. By default, this check is always performed, to ensure that the Rootstock node is running in a compatible environment.-base-path
: This specifies the value ofdatabase.dir
, where the blockchain database is stored.
Example:
java -cp rsk-core-<VERSION>.jar co.rsk.start -base-path home/rsk/data
-rpccors
This specifies the value ofrpc.providers.web.cors
to controlcors configuration
.
Example:
java -cp rsk-core-<VERSION>.jar co.rsk.start -rpccors *
Command Line Tools
It worth highlight that for some commands below that interacts with the database, you might and should set the network flag desired, like
--regtest
, --testnet
or --main
. Otherwise, the default network will be used, which is the Rootstock Mainnet (public network).
Database related commands
ExportState
The ExportState
command is a tool for exporting the state at a specific block in the Rootstock blockchain to a file.
Usage:
java -cp rsk.jar co.rsk.cli.tools.ExportState -b <block_number> -f <file_path> --<network_flag>
Options:
-
-b, --block
: The block number to export the state from. -
-f, --file
: The path to a file to export the state to.
Example:
In this example, the state information of block 2000 will be exported to the file “test.txt” on the regtest network.
java -cp rsk.jar co.rsk.cli.tools.ExportState -b 2000 -f test.txt --regtest
Output:
INFO [clitool] [main] ExportState started
INFO [o.e.d.CacheSnapshotHandler] [main] Loaded 194912 cache entries from 'unitrie/rskcache'
INFO [clitool] [main] ExportState finished
INFO [o.e.d.CacheSnapshotHandler] [main] Saved 194912 cache entries in 'unitrie/rskcache'
The “test.txt” should look like this:
5c0700caa04b0e28aa38d3d4a74a560332c38111cb1ac2292a89512d009658d2a7ed7d2cecc372b5c25799434b1cc5e49d795fc371db88e3d0c3635e273fc3c496b897fdc60c
4ce5c4861124fac10fdda43f62df4cf8137136e4c654305a8e9e3572f76b46c9fd9ce59676
…etc