Quantcast
Channel: Yudiz Solutions Ltd.
Viewing all articles
Browse latest Browse all 595

First Transaction on Libra Blockchain

$
0
0

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.

libra_image1

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

Lets begin with the steps of executing your first transaction.

libra_image2

Step:1 Clone the Libra Core Repository

Git clone: https://github.com/libra/libra.git

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:

  1. Installs rustup
  2. Installs rust-toolchain
  3. Installs CMake
  4. Installs protoc
  5. Installs Go

Step:3 Build Libra CLI Client and Connect to the Testnet

./scripts/cli/start_cli_testnet.sh

libra_image3

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

libra_image5

Step:5 Create My Account

libra% account create

libra_image6

#0 is the index of My account.

Step:6 Create My’s Account

libra% account create

libra_image7

#1 is the index for My Friend’s account.

Step:7 (optional) List Accounts

libra% account list

libra_image8

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.

libra_image9

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.

libra_image10

Step: 10 Check the Balance

libra% query balance 0

libra_image11

 

 

libra% query balance 1

libra_image12_2

Step: 11 Query the Accounts’ Sequence Numbers

libra% query sequence 0

libra_image13

 

 

 

libra% query sequence 1

libra_image14

 

 

 

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.

libra_image15

Step: 13 Retrieve the information about the transaction

libra% query txn_acc_seq 0 0 true

libra_image16

Step: 14 Query Sequence Number After Transfer

libra% query sequence 0

libra_image17

 

 

 

libra% query sequence 1

libra_image18

 

 

 

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_image19

 

 

libra% query balance 1

libra_image20

 

 

Congratulations!

libra_image21

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.


Viewing all articles
Browse latest Browse all 595

Trending Articles