Stellar CLI Manual
This document contains the help content for the stellar
command-line program.
stellar
Work seamlessly with Stellar accounts, contracts, and assets from the command line.
- Generate and manage keys and accounts
- Build, deploy, and interact with contracts
- Deploy asset contracts
- Stream events
- Start local testnets
- Decode, encode XDR
- More!
For additional information see:
- Stellar Docs: https://developers.stellar.org
- Smart Contract Docs: https://developers.stellar.org/docs/build/smart-contracts/overview
- CLI Docs: https://developers.stellar.org/docs/tools/stellar-cli
To get started generate a new identity:
stellar keys generate alice
Use keys with the --source
flag in other commands.
Commands that work with contracts are organized under the contract
subcommand. List them:
stellar contract --help
Use contracts like a CLI:
stellar contract invoke --id CCR6QKTWZQYW6YUJ7UP7XXZRLWQPFRV6SWBLQS4ZQOSAF4BOUD77OTE2 --source alice --network testnet -- --help
Anything after the --
double dash (the "slop") is parsed as arguments to the contract-specific CLI, generated on-the-fly from the contract schema. For the hello world example, with a function called hello
that takes one string argument to
, here's how you invoke it:
stellar contract invoke --id CCR6QKTWZQYW6YUJ7UP7XXZRLWQPFRV6SWBLQS4ZQOSAF4BOUD77OTE2 --source alice --network testnet -- hello --to world
Usage: stellar [OPTIONS] <COMMAND>
Subcommands:
contract
— Tools for smart contract developersevents
— Watch the network for contract eventskeys
— Create and manage identities including keys and addressesnetwork
— Start and configure networkssnapshot
— Download a snapshot of a ledger from an archivetx
— Sign, Simulate, and Send transactionsxdr
— Decode and encode XDRcompletion
— Print shell completion code for the specified shellcache
— Cache for transactions and contract specsversion
— Print version information
Options:
--global
— Use global config--config-dir <CONFIG_DIR>
— Location of config directory, default is "."-f
,--filter-logs <FILTER_LOGS>
— Filter logs output. To turn onstellar_cli::log::footprint=debug
or off=off
. Can also use env varRUST_LOG
-q
,--quiet
— Do not write logs to stderr includingINFO
-v
,--verbose
— Log DEBUG events--very-verbose
— Log DEBUG and TRACE events--list
— List installed plugins. E.g.stellar-hello
--no-cache
— Do not cache your simulations and transactions
stellar contract
Tools for smart contract developers
Usage: stellar contract <COMMAND>
Subcommands:
asset
— Utilities to deploy a Stellar Asset Contract or get its idalias
— Utilities to manage contract aliasesbindings
— Generate code client bindings for a contractbuild
— Build a contract from sourceextend
— Extend the time to live ledger of a contract-data ledger entrydeploy
— Deploy a wasm contractfetch
— Fetch a contract's Wasm binaryid
— Generate the contract id for a given contract or assetinfo
— Access info about contractsinit
— Initialize a Soroban project with an example contractinspect
— Inspect a WASM file listing contract functions, meta, etcinstall
— Install a WASM file to the ledger without creating a contract instanceinvoke
— Invoke a contract functionoptimize
— Optimize a WASM fileread
— Print the current value of a contract-data ledger entryrestore
— Restore an evicted value for a contract-data legder entry
stellar contract asset
Utilities to deploy a Stellar Asset Contract or get its id
Usage: stellar contract asset <COMMAND>
Subcommands:
id
— Get Id of builtin Soroban Asset Contract. Deprecated, usestellar contract id asset
insteaddeploy
— Deploy builtin Soroban Asset Contract
stellar contract asset id
Get Id of builtin Soroban Asset Contract. Deprecated, use stellar contract id asset
instead
Usage: stellar contract asset id [OPTIONS] --asset <ASSET> --source-account <SOURCE_ACCOUNT>
Options:
--asset <ASSET>
— ID of the Stellar classic asset to wrap, e.g. "USDC:G...5"--rpc-url <RPC_URL>
— RPC server endpoint--network-passphrase <NETWORK_PASSPHRASE>
— Network passphrase to sign the transaction sent to the rpc server--network <NETWORK>
— Name of network to use from config--source-account <SOURCE_ACCOUNT>
— Account that signs the final transaction. Aliassource
. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…")--hd-path <HD_PATH>
— If using a seed phrase, which hierarchical deterministic path to use, e.g.m/44'/148'/{hd_path}
. Example:--hd-path 1
. Default:0
--global
— Use global config--config-dir <CONFIG_DIR>
— Location of config directory, default is "."
stellar contract asset deploy
Deploy builtin Soroban Asset Contract
Usage: stellar contract asset deploy [OPTIONS] --asset <ASSET> --source-account <SOURCE_ACCOUNT>
Options:
-
--asset <ASSET>
— ID of the Stellar classic asset to wrap, e.g. "USDC:G...5" -
--rpc-url <RPC_URL>
— RPC server endpoint -
--network-passphrase <NETWORK_PASSPHRASE>
— Network passphrase to sign the transaction sent to the rpc server -
--network <NETWORK>
— Name of network to use from config -
--source-account <SOURCE_ACCOUNT>
— Account that signs the final transaction. Aliassource
. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…") -
--hd-path <HD_PATH>
— If using a seed phrase, which hierarchical deterministic path to use, e.g.m/44'/148'/{hd_path}
. Example:--hd-path 1
. Default:0
-
--global
— Use global config -
--config-dir <CONFIG_DIR>
— Location of config directory, default is "." -
--fee <FEE>
— fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlmDefault value:
100
-
--cost
— Output the cost execution to stderr -
--instructions <INSTRUCTIONS>
— Number of instructions to simulate -
--build-only
— Build the transaction and only write the base64 xdr to stdout -
--sim-only
— Simulate the transaction and only write the base64 xdr to stdout
stellar contract alias
Utilities to manage contract aliases
Usage: stellar contract alias <COMMAND>
Subcommands:
remove
— Remove contract aliasadd
— Add contract aliasshow
— Show the contract id associated with a given aliasls
— List all aliases
stellar contract alias remove
Remove contract alias
Usage: stellar contract alias remove [OPTIONS] <ALIAS>
Arguments:
<ALIAS>
— The contract alias that will be removed
Options:
--global
— Use global config--config-dir <CONFIG_DIR>
— Location of config directory, default is "."--rpc-url <RPC_URL>
— RPC server endpoint--network-passphrase <NETWORK_PASSPHRASE>
— Network passphrase to sign the transaction sent to the rpc server--network <NETWORK>
— Name of network to use from config
stellar contract alias add
Add contract alias
Usage: stellar contract alias add [OPTIONS] --id <CONTRACT_ID> <ALIAS>
Arguments:
<ALIAS>
— The contract alias that will be removed
Options:
--global
— Use global config--config-dir <CONFIG_DIR>
— Location of config directory, default is "."--rpc-url <RPC_URL>
— RPC server endpoint--network-passphrase <NETWORK_PASSPHRASE>
— Network passphrase to sign the transaction sent to the rpc server--network <NETWORK>
— Name of network to use from config--overwrite
— Overwrite the contract alias if it already exists--id <CONTRACT_ID>
— The contract id that will be associated with the alias
stellar contract alias show
Show the contract id associated with a given alias
Usage: stellar contract alias show [OPTIONS] <ALIAS>
Arguments:
<ALIAS>
— The contract alias that will be displayed