Skip to main content

Payments and Assets

To send payments and work with assets using the Stellar CLI, follow these steps:

  1. 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.

  1. Fund the accounts:
stellar keys generate alice -q
stellar keys generate bob -q
stellar keys fund alice
stellar keys fund bob
  1. Obtain the stellar asset contract ID:
stellar contract id asset --asset native
  1. Get Bob's public key:
stellar keys address bob
  1. 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
  1. 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.