Run Commands with the CLI
The VSL command-line interface gives you access to the VSL server by allowing you to perform certain operations using commands that follow the format below:
Installing the VSL CLI
To get started, you’ll need to install the VSL CLI on your machine.
There are two ways to install the CLI, depending on whether you want to copy the binary to a global location (accessible from anywhere using vsl-cli) or just build it locally.
Prerequisites
For this installation to be successful, you need to have the following:
You need Rust installed on your local machine. For this, head to the official Rust installation documentation.
Clone the VSL CLI repository.
Option 1: Install globally using cargo install
This method installs the CLI in release mode and adds it to your system’s $PATH, allowing you to run vsl-cli from any location.
Run the following command from the root of the project:
Once installed, you can start using the CLI directly:
Option 2: Build locally in release mode
If you don’t want to install globally, you can build the CLI and run it from the local target directory.
Build the CLI using the following command:
After a successful build, the binary will be available at:
You can then run commands using the full path, like so:
Starting the VSL CLI in REPL mode
The REPL (Read-Eval-Print Loop) lets you interactively run VSL commands, which is especially useful for local testing.
To switch to REPL mode, run the following commands:
You should see a CLI prompt like this:
From here, you can run any VSL command interactively.
For example, if you wanted to view your asset balance, you could simply run the following command:
You should see an output like this:
To start working with the VSL, you need to establish a connection to the server.
You can start the VSL server from within the REPL using an external VSL database or a temporary one.
The following steps will guide you through launching a server using a temporary database:
Step 1: Launch the server
You should see output similar to:
Step 2: Confirm the network connection
Expected output:
At this point, you're connected to a live local VSL server and ready to run operations against the VSL database.
Running your first commands
Here are a few common commands to help you get started:
1. Create an account
To perform any operation on the database, we first need to set up an account.
Generate a new VSL account:
To view the current server state, including accounts and assets, run:
You should see an output similar to the following:
List all accounts available accounts on this server:
The output should look something like this:
You can also choose to switch between any of these accounts using the command below:
The output should look something like this:
2. Create an asset
Immediately after setting up an account, you can now perform certain actions on the account. One of such actions is creating an asset.
You should see the following output:
You can now request to see all the asset balances that are connected to this account. You can do this by running the following command:
You should see the following output:
Learn more
This is just a starting point. To explore everything you can do with the CLI, check out the full VSL CLI Reference Guide.
Last updated
Was this helpful?