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:
Ensure you have Cargo installed. If you don't have it, we recommend you install it using Rustup. Then run:
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:
Open the file and add the following:
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.
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.
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.
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.
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¶
Deposit some BTC on Strata¶
After you've received your BTC, you can deposit some onto Strata.
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.
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.
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.
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.
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.
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.
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.
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.
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.