sawadm

The sawadm command is used for Sawtooth administration tasks. The sawadm subcommands create validator keys during initial configuration and help create the genesis block when initializing a validator.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
usage: sawadm [-h] [-v] [-V] {genesis,keygen} ...

Provides subcommands to create validator keys and create the genesis block

optional arguments:
  -h, --help        show this help message and exit
  -v, --verbose     enable more verbose output
  -V, --version     display version information

subcommands:
  {genesis,keygen}
    genesis         Creates the genesis.batch file for initializing the
                    validator
    keygen          Generates keys for the validator to use when signing
                    blocks

sawadm genesis

The sawadm genesis subcommand produces a file for use during the initialization of a validator. A network requires an initial block (known as the genesis block) whose signature will determine the block chain id. This initial block is produced from a list of batches, which will be applied at genesis time.

The optional argument input_file specifies one or more files containing serialized BatchList protobuf messages to add to the genesis data. (Use a space to separate multiple files.) If no input file is specified, sawadm keygen produces an empty genesis block.

The output is a file containing a serialized GenesisData protobuf message. This file, when placed at sawtooth_data/genesis.batch, will trigger the genesis process.

Note

The location of sawtooth_data depends on whether the environment variable SAWTOOTH_HOME is set. If it is, then sawtooth_data is located at SAWTOOTH_HOME/data. If it is not, then sawtooth_data is located at /var/lib/sawtooth.

When sawadm genesis runs, it displays the path and filename of the target file where the serialized GenesisData is written. (Default: sawtooth_data/genesis.batch.) For example:

$ sawadm genesis config.batch mktplace.batch
Generating /var/lib/sawtooth/genesis.batch

Use --output filename to specify a different name for the target file.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
usage: sawadm genesis [-h] [-v] [-V] [-o OUTPUT] [input_file [input_file ...]]

Generates the genesis.batch file for initializing the validator.

positional arguments:
  input_file            file or files containing batches to add to the
                        resulting GenesisData

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         enable more verbose output
  -V, --version         display version information
  -o OUTPUT, --output OUTPUT
                        choose the output file for GenesisData

This command generates a serialized GenesisData protobuf message and stores it
in the genesis.batch file. One or more input files (optional) can contain
serialized BatchList protobuf messages to add to the GenesisData. The output
shows the location of this file. By default, the genesis.batch file is stored
in /var/lib/sawtooth. If $SAWTOOTH_HOME is set, the location is
$SAWTOOTH_HOME/data/genesis.batch. Use the --output option to change the name
of the file.

sawadm keygen

The sawadm keygen subcommand generates keys that the validator uses to sign blocks. This system-wide key must be created during Sawtooth configuration.

Validator keys are stored in the directory /etc/sawtooth/keys/. By default, the public-private key files are named validator.priv and validator.pub. Use the <key-name> argument to specify a different file name.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
usage: sawadm keygen [-h] [-v] [-V] [--force] [-q] [key_name]

Generates keys for the validator to use when signing blocks.

positional arguments:
  key_name       name of the key to create

optional arguments:
  -h, --help     show this help message and exit
  -v, --verbose  enable more verbose output
  -V, --version  display version information
  --force        overwrite files if they exist
  -q, --quiet    do not display output

The private and public key pair is stored in /etc/sawtooth/keys/<key-
name>.priv and /etc/sawtooth/keys/<key-name>.pub.