6.5 DGT CLI and base transaction families

Each node has a CLI (Command Line Interface) service as a component. To run the CLI, you need to access the bash shell inside the container:

docker exec -it shell-dgt-c1-1 bash

Inside, it is possible to enter commands regarding the node’s status and the testing families of transactions. Different families of commands may have some differences in options; here is a general view based on the dgt transaction family:

#

Command

Description

Example

1

dgt Family

A set of commands that provide basic information about the node and its environment, as well as a way to access the most important common functions.

1.1

dgt settings list

Displays a list of settings for the node and current network.

Since multiple nodes can be running in a container, a clarification in the form of a url flag is needed

dgt settings list --url http://api-dgt-c1-1:8108

1.2

dgt batch list

Displays a list of transaction batches: BATCH_ID, the number of transactions in a batch and signatures.

Information can be exported to a file with the -F option and output redirection

dgt batch list –url http://api-dgt-c1-1:8108

dgt batch list –url http://api-dgt-c1-1:8108 -F > 1.csv

1.3

dgt batch status

Status of the given batch with BATCH_ID shown (obtained, for example, from the dgt batch list command)

dgt batch status 3044022052d2468ef…

--url http://api-dgt-c1-1:8108

1.4

dgt batch submit

The command sends one or several batches to the validator.

A batch is a binary file, coded in BatchList protobuf, represented by a FILENAME file.

dgt batch submit --url http://api-dgt-c1-1:8108 -f FILENAME

1.5

dgt block list

Output of packed blocks as a list in NUM format:

BLOCK_ID; BATS; TXNS; SIGNER

dgt block list --url http://api-dgt-c1-1:8108

1.6

dgt block show

Shows the contents of a block, displayed on command

dgt block show [-h] [--url URL] block_id

dgt block show 102678a34f…

--url http://api-dgt-c1-1:8108

1.7

dgt keygen

Key pair generation (private and public). As a result, files are created in the specified directory:

<key_dir>/<key_name>.priv and <key_dir>/<key_name>.pub

Command format: dgt keygen [-h] [--key-dir KEY_DIR] [--force] [-q] [key_name]

-q – don’t display output

--key-dir KEY_DIR – directory where keys are generated

--force – files are overwritten

dgt keygen NEWKEY

creates NEWKEY.priv and NEWKEY.pub in the /root/.dgt/keys/ catalogue by default

1.8

dgt peer list

List of addresses of connected validators. If there are no connected nodes, an empty string is displayed.

dgt peer list

--url http://api-dgt-c1-1:8108

1.9

dgt state list

Printing entries in the ledger, returns the corresponding addresses in the format ADDRESS; SIZE;DATA

dgt state list

--url http://api-dgt-c1-1:8108

1.10

dgt state show

The command outputs a specific ledger entry for the given address:

dgt state list [-h] [--url URL[-F {csv,json,yaml,default}] [--head HEAD][subtree]

Here:

address – address in DAG;

--head HEAD - specify the id of the block to set as the chain head

dgt state show

--url http://api-dgt-c1-1:8108 00000034c8768f9d68b36c758…

1.11

dgt transaction list

Returns a list of transactions for the given node. Command format:

transaction list [-h] [--url URL] [-u USERNAME[:PASSWORD]] [-F {csv,json,yaml,default}]

Default information output: Transaction_ID; Family; Vers,Size;Payload

dgt transaction list

--url http://api-dgt-c1-1:8108

1.12

dgt transaction show

Displays information about a specific transaction, requires TRANSACTION_ID:

dgt transaction show [-h] [--url URL] [-k KEY] [-F {yaml,json}] transaction_id

--url URL identify the URL of the validator's REST API

-k KEY, --key KEY displays a single property from the block or header

dgt transaction list

--url http://api-dgt-c1-1:8108 023567df4e2345…

1.13

dgt dag show integrity

dag integrity check.

dgt dag show integrity –url URL

dgt dag show integrity –url http://api-dgt-c1-1:8108

1.14

dgt dag show val

List of vertices to join

dgt dag show val –url URL

The number of the block:

the block’s ID fragment (leaves for new blocks to join).

For example,

0:30450221

112:30440220

dgt dag show val --url http://api-dgt-c1-1:8108

2

xcert Family

Management of node certificates. Several scenarios for joining a node to the network may require the creation of a relevant certificate.

2.1

xcert set

Creation of a new certificate:

Edit the PROJECT-FOLDER/etc/certificate.json file

Generate a certificate with the command:

xcert --user USER --url URL --keyfile KEYFILE --wait [WAIT] --before BEFORE --after AFTER –cb CRYPTO_BACK, here:

xcert set /project/dgt/etc/certificate.jsomcn --user /root/.dgt/keys/root.priv

2.2

xcert list

Output of previously generated certificates. Command format:

xcert list --url URL --keyfile KEYFILE --cb CRYPTO_BACK

xcert list

2.3

xcert show

Prints the specified certificate to the screen. Format:

xcert show name

The public key is used as the name (also accessible in the output of the xcert list command)

xcert show 3056301006072a8648ce3 ... cabfe613909acb6c5791cbfebd0ef5b8630fa6c9b3182

2.4

xcert upd

Certificate renewal, specified in the format:

xcert upd VALUE --url URL --keyfile KEYFILE --before BEFOREDAYS --after AFTERDAYS

Here:

VALUE – link to the JSON – file with parameters;

--url – node URL

--keyfile – link to a certificate with a private key

--before – the number of days before today’s date that allow the certificate to be considered valid

--after – the link to the number of days after, which allow the certificate to be considered valid

xcert upd /project/bgx/etc/certificate.json --url http://api-dgt-c1-1:8108 --keyfile /root/.dgt/keys/root.priv --before 245 –after 164

3

dgtset

Topology transaction family

3.1

dgtset genesis

Performed automatically when launching a node with a -G parameter, does not require repetition

⚠ NOT RECOMMENDED FOR USE OUTSIDE OF DEVELOPMENT

3.2

dgtset proposal

This command is used only when launching a node and creates a command file (batch) for recording the genesis block – including the topology

⚠ NOT RECOMMENDED FOR USE OUTSIDE OF DEVELOPMENT

3.3

dgtset topology

Displays the current topology: dgtset topology list –url URL

The statistic topology is given in the CORE/etc/dgt.net.static file. It is loaded into the genesis block during the network initialization and is modified by topology commands

dgtset topology list –url http://api-dgt-c1-1:8108

4

bgt Family

Test family of transactions; provides the creation of wallets and the transfer of abstract bgt tokens to them

4.1

bgt set

Creation of a new wallet with a command format of:

bgt set name value –url URL –keyfile KEYFILE –wait [WAIT]

bgt set WAL1 1000 –url http://api-dgt-c1-1:8108

4.2

bgt inc

Increasing the volume of tokens in the wallet:

bgt inc name value --url URL --keyfile KEYFILE –wait [WAIT]

bgt inc WAL1 50 –url http://api-dgt-c1-1:8108

4.3

bgt dec

Reducing the number of tokens in the wallet:

bgt inc name value --url URL --keyfile KEYFILE –wait [WAIT]

bgt dec WAL1 50 –url http://api-dgt-c1-1:8108

4.4

bgt trans

Transferring tokens from wallet to wallet:

bgt trans name value to --url URL --keyfile KEYFILE --wait [WAIT]

bgt trans WAL1 50 WAL2 –url http://api-dgt-c1-1:8108

4.5

bgt show

Shows the value of BGT Tokens for a given wallet: bgt show --url URL

bgt show --url http://api-dgt-c1-1:8108

4.6

bgt list

Displays all available wallets.

bgt list --url URL

bgt list --url http://api-dgt-c1-1:8108

Last updated