Overview
Imagine that one of your friends lives across the sea & he/she requires some Libra coin, which you have in abundance. How cool it would be if you were able to send the coins via Facebook or WhatsApp.
Sounds really surprising, right? Just read through the entire blog and you’ll know how.
Recently, Facebook launched the testnet of the Libra Blockchain. Today, we are going to perform our 1st transaction on the testnet.
If you aren’t familiar with the concept, go through our previous blog – Introduction of Libra and you’ll get familiarized. Check out from Yudiz Portfolio Link.
Lets begin with the steps of executing your first transaction.
Topics
- Clone the Libra Core Repository
- Setup Libra Core
- Build Libra CLI Client and Connect to the Testnet
- Check If the CLI Client Is Running on Your System
- Create My Account
- Create My’s Account
- List Accounts
- Add Libra to My Account
- Add Libra to My Friend’s Account
- Check the Balance
- Query the Accounts’ Sequence Numbers
- Transfer Money
- Retrieve the information about the transaction
- Query Sequence Number After Transfer
- Check the Balance in Both Accounts After Transfer
Step:1 Clone the Libra Core Repository
Step:2 Setup Libra Core
cd libra
./scripts/dev_setup.sh
To setup Libra Core, run the setup script to install the dependencies.
The setup script performs these actions:
- Installs rustup
- Installs rust-toolchain
- Installs CMake
- Installs protoc
- Installs Go
Step:3 Build Libra CLI Client and Connect to the Testnet
./scripts/cli/start_cli_testnet.sh
To connect to a validator node running on the Libra testnet.
Step:4 Check If the CLI Client Is Running on Your System
libra% account
Step:5 Create My Account
libra% account create
#0 is the index of My account.
Step:6 Create My’s Account
libra% account create
#1 is the index for My Friend’s account.
Step:7 (optional) List Accounts
libra% account list
Add Libra Coins to My and My Friend’s Accounts
Step:8 Add Libra to My Account
libra% account mint 0 100
- 0 is the index of My account.
- 100 is the amount of Libra to be added to My account.
Step: 9 Add Libra to My Friend’s Account
libra% account mint 1 200
- 1 is the index of My Friend’s account.
- 200 is the amount of Libra to be added to My Friend’s account.
Step: 10 Check the Balance
libra% query balance 0
libra% query balance 1
Step: 11 Query the Accounts’ Sequence Numbers
libra% query sequence 0
libra% query sequence 1
A sequence number of 0 for both My and My Friend’s accounts indicates that no transactions from either My or My Friend’s account has been executed so far.
Step: 12 Transfer Money
libra% transfer 0 1 10
- 0 is the index of My account.
- 1 is the index of My Friend’s account.
- 10 is the number of Libra to transfer.
Step: 13 Retrieve the information about the transaction
libra% query txn_acc_seq 0 0 true
Step: 14 Query Sequence Number After Transfer
libra% query sequence 0
libra% query sequence 1
Each time a transaction is sent from an account, the sequence number is increased by 1.
Step: 15 Check the Balance in Both Accounts After Transfer
libra% query balance 0
libra% query balance 1
Congratulations!
You have effectively executed your transaction on the Libra testnet and transferred 10 Libra from My account to My Friend’s account!
Demo Video:
Conclusion
So in a nutshell, we have learnt how to do a first transaction on Libra Blockchain. Will be coming up with more examples and detailing in my upcoming blog. So stay tuned & keep reading.