First Transactions

Once the client connects to a node on the testnet, you will see the following output.

usage: <command> <args>

Use the following commands:

account | a
  Account operations
query | q
  Query operations
transfer | transferb | t | tb
  <sender_account_address>|<sender_account_ref_id> <receiver_account_address>|<receiver_account_ref_id> <number_of_coins> [gas_unit_price (default=0)] [max_gas_amount (default 10000)] Suffix 'b' is for blocking.
  Transfer coins from account to another.
help | h
  Prints this help
quit | q!
  Exit this client


Please, input commands:

libra%

Create x and y Account

Step 1: Check If the CLI Client Is Running on Your System

A libra% command line prompt indicates that your Libra CLI client is running. To see the help information for the account command enter “account” as shown below:

libra% account
usage: account <arg>

Use the following args for this command:

create | c
  Create an account. Returns reference ID to use in other operations
list | la
  Print all accounts that were created or loaded
recover | r <file path>

  Recover Libra wallet from the file path
write | w <file name>

  Save Libra wallet mnemonic recovery seed to disk
mint | mintb | m | mb <receiver account> <number of coins>
  Mint coins to the account. Suffix 'b' is for blocking

Step 2: Create Alice’s Account

Note that creating an account using the CLI does not update the blockchain, it just creates a local key-pair.

To create x account, enter this command:

libra% account create

Sample output on success:

>> Creating/retrieving next account from wallet
Created/retrieved account #0 address 3ed8e5fafae4147b2a105a0be2f81972883441cfaaadf93fc0868e7a0253c4a8

Create y account, enter the same command:

libra% account create

Sample output on success:

>> Creating/retrieving next account from wallet
Created/retrieved account #1 address 8337aac709a41fe6be03cad8878a0d4209740b1608f8a81566c9a7d4b95a2ec7

Step 4 (Optional): List Accounts

To list the accounts you have created, enter this command:

libra% account list

Sample output on success:

User account index: 0, address: 3ed8e5fafae4147b2a105a0be2f81972883441cfaaadf93fc0868e7a0253c4a8, sequence number: 0
User account index: 1, address: 8337aac709a41fe6be03cad8878a0d4209740b1608f8a81566c9a7d4b95a2ec, sequence number: 0

Add # Coins to x and y Accounts

Step 1: Add 110 Libra to x’s Account

To mint Libra and add to x account, enter this command:

libra% account mint 0 110

  • 0 is the index of x account.

  • 110 is the amount of Libra to be added to Alice’s account.

A successful account mint command will also create Alice’s account on the blockchain.

Sample output on success:

>> Minting coins
Mint request submitted

Step 2: Add 52 Libra to Bob’s Account

To mint Libra and add to y account, enter this command:

libra% account mint 1 52

  • 1 is the index of y account.

  • 52 is the amount of Libra to be added to y account.

  • A successful account mint command will also create y account on the blockchain. Another way to create y account on the blockchain is to transfer money from x account to y account.

Sample output on success:

>> Minting coins
Mint request submitted

Step 3: Check the Balance

To check the balance in x account, enter this command:

libra% query balance 0

Sample output on success:

Balance is: 110

To check the balance in y account, enter this command:

libra% query balance 1

Sample output on success:

Balance is: 52

Submit a Transaction

Before we submit a transaction to transfer Libra from x account to y account, we will query the sequence number of each account. This will help us understand how executing a transaction changes the sequence number of each account.

Transfer Money

To submit a transaction to transfer 10 Libra from x account to y account, enter this command:

libra% transfer 0 1 10

  • 0 is the index of x account.

  • 1 is the index of y account.

  • 10 is the number of Libra to transfer from x account to y account.

Sample output on success:

>> Transferring
Transaction submitted to validator
To query for transaction status, run: query txn_acc_seq 0 0 <fetch_events=true|false>

Last updated

Was this helpful?