Payments and Assets
To send payments and work with assets using the Stellar CLI, follow these steps:
- Set your preferred network. For this guide, we will use
testnet
. A list of available networks can be found here
export STELLAR_NETWORK=testnet
By setting the STELLAR_NETWORK
environment variable, we will not have to set the --network
argument when using the CLI.
- Fund the accounts:
stellar keys generate alice -q
stellar keys generate bob -q
stellar keys fund alice
stellar keys fund bob
- Obtain the stellar asset contract ID:
stellar contract id asset --asset native
- Get Bob's public key:
stellar keys address bob
- Send 100 XLM from Alice to Bob:
stellar contract invoke --id <asset_contract_ID> --source-account alice -- transfer --to <Bob_ID> --from alice --amount 100
- Check account balance:
stellar contract invoke --id <asset_contract_ID> --source-account alice -- balance --id <account ID>
For more information on the functions available to the stellar asset contract, see the token interface code.
Guides in this category:
ποΈ Contract Lifecycle
Manage the lifecycle of a Stellar smart contract using the CLI
ποΈ Deploy a contract from installed Wasm bytecode
Deploy an instance of a compiled contract that is already installed on the network
ποΈ Deploy the Stellar Asset Contract for a Stellar asset
Deploy an SAC for a Stellar asset so that it can interact with smart contracts
ποΈ Extend a deployed contract instance's TTL
Use the CLI to extend the time to live (TTL) of a contract instance
ποΈ Extend a deployed contract's storage entry TTL
Use the CLI to extend the time to live (TTL) of a contract's persistent storage entry
ποΈ Extend a deployed contract's Wasm code TTL
Use Stellar CLI to extend contract's Wasm bytecode TTL, with or without local binary
ποΈ Install and deploy a smart contract
Combine the install and deploy commands in the Stellar CLI to accomplish both tasks
ποΈ Install Wasm bytecode
Use the Stellar CLI to install a compiled smart contract on the ledger
ποΈ Payments and Assets
Send XLM, stellar classic, or a soroban asset using the Stellar CLI
ποΈ Restore an archived contract using the Stellar CLI
Restore an archived contract instance using the Stellar CLI
ποΈ Restore archived contract data using the Stellar CLI
Restore archived contract storage entries using Stellar CLI