SatLayer CLI
The SatLayer CLI tool allows developers to deploy, update and query BVS. It is an useful tool during development and avoids the complication of interacting with BVS/SatLayer's core contracts using the raw babylond
command.
The SatLayer CLI tool is constructed on top of the ChainIO library, with just a minimal layer of code for handling user inputs. Everything the CLI can accomplish is also possible with ChainIO.
Installing SatLayer CLI
The SatLayer CLI is written in the Go programming language. Hence the Go compiler is needed in order to build the CLI tool. Methods to install golang differ depending on the operating system you are using. Generally, please follow the instructions on the Golang install page to install the Go compiler.
For Linux users, follow the installation instructions according to the distribution you are using. For Ubuntu and other Debian-based system, run:
For Arch based systems, run:
For Fedora and other RHEL based systems, run:
With the Golang compiler installed, run the following to build the SatLayer CLI.
By default the satlayer-cli
uses the os
keyring backend. This allows key sharing between the Babylon command line and satlayer-cli
. Enabling seamless inter-operation. Please refer to Cosmos's Keyring document for details.
Installation
satlayer-cli
can be installed by running go install
. This installs the built result into golang's default installation directory.
This installs to $HOME/go/bin
. Please make sure to have this path added to your PATH environment variable. Please make sure the directory is in your system's PATH
environment variable. For UNIX users (Linux, MacOS, etc..)
Then source
your shell rc scrip or start a new shell to active it.
On Windows or UNIX with PowerShell you should edit the $profile
file (run echo $profile
in PowerShell to acquire the file path) and append the following.
Close and start a new PowerShell session to activate the change.
Configuration
By default the configuration file is stored in $HOME/.config/satlayer/config.toml
(or %USERPROFILE%\.config\satlayer\config.toml
on Windows). You can set the SATLAYER_CONFIG
environment variable to change where the configuration is loaded from. There is no need to set this variable if you wish to use the default configuration file path.
On *NIX (Linux, MacOS, etc..), assuming a BASH or DASH compatible shell:
On Windows, or using PowerShell on *NIX, remember to Remove-Item
afterwards as PowerShell does not support temporary variables.
Command Structure
The SatLayer CLI is a monolithic program (in opposite to how most classic UNIX commands) with layered sub-commands.
Commands are in the format of the following.
Subcommands could be layered and flags follows the UNIX convention. A double dash (
--
) is used for long names and a single dash (-
) is used for short, single character flags and options.
Notation conversion
We follow the convention of what is used by most GNU and BSD commands:
Optional parameters are enclosed in
[square-brackets]
Required parameters are free-formed
without-any-decoration
Template/string expected to be provided by user is in
<angle-brackets>
Flags/options can be followed by zero or more parameters. For example
-v
in a flag with no parameters-f <path-to-file>
is an option that accepts a parameter-c <files>...
indicates it accepts multiple parameters
For example, my-command read -f <path-to-file> [-v]
indicates:
The command name is
my-command
The subcommand is
read
and is mandatoryThe
-f
option is required and it is followed by a path to a fileAnd the
-v
option is optional without any parameter following it.
Built-in help
Every command and sub-commands of the SatLayer CLI includes built-in help message for quick access.
They can be displayed by either running the help
subcommand or via the --help
or -h
flag. They generally follow the same notation used in this document.
For example:
Common parameters
The user-key-name
parameter is very common among commands. To reduce the amount of text in the document. The option will not be described in each command documentation. user-key-name
is a mandatory parameter that specifies which key in the keyring is used to invoke a contract.
Last updated