Skip to content

Command Line Interface Reference

Waruta edited this page Jan 26, 2023 · 9 revisions

Using STAI Commands

  • Open the command prompt.
  • Enter cd %localappdata%\stai-blockchain\app-<version>\resources\app.asar.unpacked\daemon, replacing <version> with your current version of STAI. For example, if you're using STAI 1.3.0, you would type cd %localappdata%\stai-blockchain\app-1.3.0\resources\app.asar.unpacked\daemon.

STAI's parent directory is /usr/lib/stai-blockchain/resources/app.asar.unpacked/daemon.

  • Open the terminal.
  • Try stai -h and see if it works. If it doesn't work, try the following:
    • Add the parent directory to $PATH.
    • Change into the parent directory. If you have to do this, make sure to type ./stai instead of stai when using commands.

Mac OS/Linux (source install)

In the terminal, make sure you're in the stai-blockchain directory and type . ./activate.


Overview (stai -h)

Usage: stai [OPTIONS] COMMAND [ARGS]...

Options:
  --root-path PATH            Config file root
                             

  --keys-root-path PATH       Keyring file root

  --passphrase-file FILENAME  File or descriptor to read the keyring
                              passphrase from

  -h, --help                  Show this message and exit.

Commands:
  configure   Modify configuration
  db          Manage the blockchain database
  farm        Manage your farm
  init        Create or migrate the configuration
  keys        Manage your keys
  netspace    Estimate total farmed space on the network
  passphrase  Manage your keyring passphrase
  plots       Manage your plots
  plotters    Advanced plotting options
  run_daemon  Runs stai daemon
  show        Show node information
  start       Start service groups
  stop        Stop services
  version     Show stai version
  wallet      Manage your wallet

Keys

Display all the keys registered by client

stai keys show

Show the mnemonic seed of the keys

stai keys show --show-mnemonic-seed

Generate and add a key to keychain

stai keys generate

Add a private key by mnemonic

stai keys add


Plots

Add a directory of plots

stai plots add -d <path>

Check plots

stai plots check

Create plots

stai plots create


Start & Stop services

Start all stai daemon processes

stai start all

Start the stai full node service

stai start node

Start the wallet, farmer, harvester and a full node

stai start farmer

Restart services

stai start farmer -r

Shut down all stai processes, including the daemon

stai stop -d all


Wallet

Get a wallet receive address

stai wallet get_address

Send stai to another wallet

stai wallet send

Show wallet information

stai wallet show


Useful Commands

Show the Help message

stai -h

Create a new configuration or migrate from previous versions to current

stai init

Show the latest challenges

stai farm challenges

Summary of farming information

stai farm summary

List nodes connected to this Full Node

stai show -c

Show the current state of the blockchain

stai show -s

Connect to another Full Node by ip:port (default P2P port is 1999)

stai show -a <ip>:<port>


Upgrading a Blockchain Database to the V2 Format

Upgrading the database on STAI is the same as upgrading the database on Chia, so this guide is only for people who don't know how to do that.

A V2 format database will take up less space, so it's worth upgrading to in your free time. We recommend that your blockchain database is located on an SSD for this. Non-standard database locations (set using means like symlinks, database_path: or STAI_ROOT) are supported. The upgrade may take around 10 minutes and will produce a separate database file next to the original, so make sure you have plenty of free space on your drive first.

Windows

  • Make sure the full node isn't running.
  • Open the STAI terminal.
  • Type in stai db upgrade and press enter to initiate the upgrade process. database_path will be automatically updated in config.yaml so that it will be ready to use when you start the node.
  • Once the command completes, you may delete the V1 database once you confirm the new database is working.

Mac OS/Linux (installer)

  • Make sure the full node isn't running.
  • Open the STAI terminal.
  • Type in stai db upgrade and press enter to initiate the upgrade process. database_path will be automatically updated in config.yaml so that it will be ready to use when you start the node.
  • Once the command completes, you may delete the V1 database once you confirm the new database is working.

Mac OS/Linux (source install)

  • Make sure the full node isn't running.
  • Open the terminal if it isn't already running.
  • Change into the stai-blockchain directory and enter . ./activate.
  • Type in stai db upgrade and press enter to initiate the upgrade process. database_path will be automatically updated in config.yaml so that it will be ready to use when you start the node.
  • Once the command completes, you may delete the V1 database once you confirm the new database is working.