Skip to content

Using the Strata CLI

Strata comes with a Rust command line interface that allows you to interact with Strata itself and Strata's signet bitcoin network.

Installation

Info

If you running Linux, you need a C/C++ compiler along with development libraries and tools required for compiling software; and libssl.

In Debian/Ubuntu flavored distributions you can install them with:

sudo apt install build-essential libssl-dev pkg-config

Ensure you have Cargo installed. If you don't have it, we recommend you install it using Rustup. Then run:

cargo install --git https://github.com/alpenlabs/strata --tag v0.1.1 strata-cli --locked --force

This will compile and install the binary into your system path. It may take a few minutes depending on how powerful your hardware is.

Configure the CLI

Before using the CLI, run strata config to find the location of your config.toml file. The output will look like:

1
2
3
~/.config/strata/config.toml # Linux
~/Library/Application Support/io.alpenlabs.strata/ # MacOS
C:\Users\<USER>\AppData\Roaming\strata\config.toml # Windows

Open the file and add the following:

# use esplora for the bitcoin signet backend
esplora = "https://esploraapi53d3659b.devnet-annapurna.stratabtc.org"
# EVM-compatible endpoint for Strata transactions
strata_endpoint = "https://stratareth3666f0713.devnet-annapurna.stratabtc.org"
# Alpen's hosted faucet-api
faucet_endpoint = "https://faucetf93d13fbc.devnet-annapurna.stratabtc.org/"
# mempool.space instance to explore the bitcoin signet
mempool_endpoint = "https://mempool0713bb23.devnet-annapurna.stratabtc.org"
# blockscout instance to explore Strata's chain
blockscout_endpoint = "https://blockscoutb86fae58ae.devnet-annapurna.stratabtc.org"

Then save and close the file. Now the CLI is ready to use.

How to use

The CLI is your entrypoint into developing with Strata.

Run strata --help to display the help message. If you're using a newer version, the output might be slightly different.

Usage: strata <command> [<args>]

A CLI for interacting with Strata and Alpen Labs' bitcoin signet

Options:
  --help            display usage information

Commands:
  recover           Attempt recovery of old deposit transactions
  drain             Drains the internal wallet to the provided signet and Strata
                    addresses
  balance           Prints the wallet's current balance(s)
  backup            Prints a BIP39 mnemonic encoding the internal wallet's seed
                    bytes
  deposit           Deposit 10 BTC from signet to Strata. If an address is not
                    provided, the wallet's internal Strata address will be used.
  withdraw          Withdraw 10 BTC from Strata to signet
  faucet            Request some bitcoin from the faucet
  send              Send some bitcoin from the internal wallet.
  receive           Prints a new address for the internal wallet
  change-password   Changes the seed's encryption password
  reset             DANGER: resets the CLI completely, destroying all keys and
                    databases. Keeps config.
  scan              Performs a full scan of the signet wallet
  config            Prints the location of the CLI's TOML config file

The CLI is composed of multiple commands. You can append --help to any one to see more details about what the command does and what arguments it supports.

Available via commands are a bitcoin signet wallet and an EVM-compatible Strata wallet, allowing you to use Strata without any other tools. For example, the CLI can help you deposit and withdraw BTC to/from Strata via the deposit and withdraw commands respectively.

When you first use a command, the CLI will ask you to create a new password to encrypt the wallet's secret. If you're using Windows or macOS, strata will store the encrypted secret in the operating system's keychain. On Linux, it is stored in a file in the user's home directory.

Backup your wallet

Before you start, you should make sure to backup your wallet.

1
2
3
4
5
6
7
8
Usage: strata backup [--language <language>]

Prints a BIP39 mnemonic encoding the internal wallet's seed bytes

Options:
  --language        select a language for the BIP39 mnemonic. Defaults to
                    English. Options: en, cn, cn-trad, cz, fr, it, jp, kr or es
  --help            display usage information

Keep this safe; your funds will be lost if you lose it. Don't reset a wallet when you have deposit transactions that haven't either been received on Strata yet or recovered, as the database that stores recovery information is separate to your seed, and it will be very difficult to recover those funds.

When you restore your wallet, make sure to run strata scan so the CLI can find all your previous funds. This process can take some time, depending on how many UTXOs you have.

Request some BTC

Strata uses a custom signet where Alpen Labs is the only miner. We have a faucet that you can request BTC from via the CLI.

Usage: strata faucet [<address>]

Request some bitcoin from the faucet

Positional Arguments:
  address           address that funds will be sent to. defaults to internal
                    wallet

Options:
  --help            display usage information

To receive ~10 BTC to test, run this command. If you haven't created a wallet yet, this will prompt you for a password to encrypt a new one.

strata faucet

Our signet uses accelerated block times of 30 seconds instead of the normal bitcoin mainnet's 10 minute interval to make the developer experience faster. Wait for the transaction to be confirmed. Check by copying the transaction ID provided by the CLI into the signet explorer.

You can also check your balance.

Check your balance

1
2
3
4
5
6
7
8
9
Usage: strata balance <network_type>

Prints the wallet's current balance(s)

Positional Arguments:
  network_type      either "signet" or "strata"

Options:
  --help            display usage information

Deposit some BTC on Strata

After you've received your BTC, you can deposit some onto Strata.

Usage: strata deposit [<strata_address>] [--fee-rate <fee-rate>]

Deposit 10 BTC from signet to Strata. If an address is not provided, the wallet's internal Strata address will be used.

Positional Arguments:
  strata_address

Options:
  --fee-rate        override signet fee rate in sat/vbyte. must be >=1
  --help            display usage information

Currently, Strata is limited to depositing exactly 10 BTC per transaction. This is likely to change after the devnet. To deposit 10 BTC from the internal signet wallet to the internal Strata wallet, run this command.

strata deposit

If the funds are not available in your Strata wallet (check using strata balance strata) after 1,020 signet blocks, you can run the recover command to perform an autorecovery.

Withdraw BTC back to the signet

To withdraw BTC from your Strata wallet to a signet address, use the following command. If an address is provided, it must be a P2TR address. If an address isn't provided, the CLI will send to an unused signet address from its own wallet. As with the deposit, the withdrawal amount must be exactly 10 BTC.

Usage: strata withdraw [<p2tr_address>]

Withdraw 10 BTC from Strata to signet

Positional Arguments:
  p2tr_address      the signet address to send funds to. defaults to a new
                    internal wallet address

Options:
  --help            display usage information

Send BTC

You can send some BTC from the internal signet or Strata wallet via the strata send command. The fee will automatically be determined, with options to customize this coming in the future. If you want to drain your wallet, see the drain command.

Usage: strata send <network_type> <amount> <address> [--fee-rate <fee-rate>]

Send some bitcoin from the internal wallet.

Positional Arguments:
  network_type      either "signet" or "strata"
  amount            amount to send in sats
  address           address to send to

Options:
  --fee-rate        override signet fee rate in sat/vbyte. must be >=1
  --help            display usage information

Receive BTC

You can generate an address for receiving BTC using the receive command. For the Strata wallet, this will always return the same address as it doesn't rotate accounts. The signet wallet will print a different address every time, which is a BIP-86 P2TR address. Signet addresses should not be reused.

1
2
3
4
5
6
7
8
9
Usage: strata receive <network_type>

Prints a new address for the internal wallet

Positional Arguments:
  network_type      either "signet" or "strata"

Options:
  --help            display usage information

Change wallet password

The change-password command will load your existing seed, decrypt it, and then prompt you for a new password, encrypt the seed with the new password, and overwrite the old encrypted seed.

1
2
3
4
5
6
Usage: strata change-password

Changes the seed's encryption password

Options:
  --help            display usage information

Drain the wallet

Sometimes, you might want to send all of your funds to a single address. To do this, run the strata drain command.

Signet funds can only be drained to another signet address, and Strata funds can only be drained to another Strata address. This command will not implicitly deposit/withdraw funds between the two wallets.

Usage: strata drain [-s <signet-address>] [-r <strata-address>] [--fee-rate <fee-rate>]

Drains the internal wallet to the provided signet and Strata addresses

Options:
  -s, --signet-address
                    a signet address for signet funds to be drained to
  -r, --strata-address
                    a Strata address for Strata funds to be drained to
  --fee-rate        override signet fee rate in sat/vbyte. must be >=1
  --help            display usage information

Recover

To recover any failed/expired deposit transactions, use the recover command.

Recovery of failed deposit transactions can be made 1,018 signet blocks after the deposit transaction was confirmed. With a 30 second block time, that's about 8 hours 29 min.

1
2
3
4
5
6
Usage: strata recover

Attempt recovery of old deposit transactions

Options:
  --help            display usage information

Scan your wallet

The scan command scans the signet for coins belonging to the internal wallet. This should be used after restoring from a BIP-39 mnemonic.

1
2
3
4
5
6
Usage: strata scan

Performs a full scan of the signet wallet

Options:
  --help            display usage information

Configuration

The CLI uses a TOML file for configuration. This is for advanced users only.

To find your config file location, run strata config. You can then open this file in an editor. You may only change the keys listed in the file if you want to use alternatives to the defaults provided.