Libra Blockchain

胡家維 Hu Kenneth
Jun 19 · 5 min read

Libra’s mission is to enable a simple global currency and financial infrastructure that empowers billions of people.

white-paper

developer document

libra-cli

Agenda

  • Set up Libra Testnet on Mac OS
  • Libra instruction
  • Libra account
  • Mint Libra coins into account
  • Query Libra account balance
  • Transfer Libra coins
  • Query Libra account transaction

Set up Libra Testnet on Mac OS

Clone Libra Core project

$ git clone https://github.com/libra/libra.git && cd libra

Install Libra Core

$ ./scripts/dev_setup.sh

Libra core uses Rust

Compile Libra CLI and then connect to Testnet

./scripts/cli/start_cli_testnet.sh

Libra CLI starts successfully and is connected to Testnet

Libra Instruction

libra% help
  • account | a : Account operations
  • query | q : Query data from destination chain. All query operations are blocking.
  • transfer | transferb | t | tb : <sender_account_address>|<sender_account_ref_id> <receiver_account_address>|<receiver_account_ref_id> <number_of_coins> [gas_unit_price_in_micro_libras (default=0)] [max_gas_amount_in_micro_libras (default 10000)] Suffix ‘b’ is for blocking. Transfer coins (in libra) from account to another.
  • help | h : Prints this help
  • quit | q! : Exit this client

Libra account

Instruction

libra% account

Create libra account #0 (Kenneth)

libra% account create>> Creating/retrieving next account from walletCreated/retrieved account #0 address 23a2a0f02f27643c647a8e08341ff7a5e524cb2d9faae81b4aa04bce3c7fc314

Create libra account #1(Baypay)

libra% account create>> Creating/retrieving next account from walletCreated/retrieved account #1 address c5e3945f8f0d2ce3070a161f361124d0ef90c8cfde16cb978f5c31843f598e50

Libra account list

libra% account listUser account index: 0, address: 23a2a0f02f27643c647a8e08341ff7a5e524cb2d9faae81b4aa04bce3c7fc314, sequence number: 0, status: LocalUser account index: 1, address: c5e3945f8f0d2ce3070a161f361124d0ef90c8cfde16cb978f5c31843f598e50, sequence number: 0, status: Local

Save Libra wallet mnemonic recovery seed to disk

libra% account write [file name].[extension name]
libra% account write mnemonic.txt
>> Saving Libra wallet mnemonic recovery seed to diskSaved mnemonic seed to disk

You can find a file in the libra folder

24 words in a file

Mint(Faucet) for Testnet

mint coin to Account 1

  • Send a mint transaction to mint coins to an account. If the account does not exist, the account will be created first and the coins will be minted later. Unlike other transactions, a nonexistent account itself can request a mint transaction. For the testnet, there is no explicit limit on how many coins an account can mint. It’s designed to allow the users to create coins to experiment on the testnet.
libra% account mint 0 1000>> Minting coinsMint request submitted

If you see this error, please don’t be nervous. Try it a few more times.

[ERROR] Error minting coins: Failed to query remote faucet server[status=429 Too Many Requests]: “<!DOCTYPE HTML PUBLIC \”-//W3C//DTD HTML 3.2 Final//EN\”>\n<title>429 Too Many Requests</title>\n<h1>Too Many Requests</h1>\n<p>5 per 1 minute</p>\n”

Query Libra account balance

libra% query balance [account index]libra% query balance 0Balance is: 1000

Transfer Libra coins

  • Transfer coins to the address you wish to create. If the recipient account does not exist, the recipient account will be created first and then coins will be transferred. The sender pays for both account creation and transfer.
libra% transfer [account index] [account index] [coins]libra% transfer 0 1 50>> TransferringTransaction submitted to validatorTo query for transaction status, run: query txn_acc_seq 0 0 <fetch_events=true|false>

Query sequence number of transaction of libra account

libra% query sequence [account index]libra% query sequence 0>> Getting current sequence numberSequence number is: 2

Query Libra transaction

libra% query txn_acc_seq [account_index] [sequence_number] [fetch_events]

[fetch_event ]

true: print event

false: doest not print event

libra% query txn_acc_seq 0 1 true
libra% query txn_acc_seq 0 1 false

Conclusion

Libra currently only provides very basic functions, the instructions are very simple but have not yet seen the features of the blockchain is like a consensus mechanism, decentralized ledger, etc. Looking forward to future development

*Do CLAP, COMMENT, and SHARE! I also welcome any business opportunities that arise**

I do this because I love it, but if you want me to buy me a cup of coffee I won’t say no :O )Thanks ^^

donation :

XEM: NCWZSUF4FPXJY3L3Y7657QNVBIUZ5D54F4TNJ64S

Ether : 0xf2d15dEAf62b8c4AFC0343006579E8E662c120D9

Bitcoin : 332UiyAfSXyvhqCYgDgBkNLFSf25ccNV9i

Connect: LinkedIn Telegram Facebook

Coinmonks

Coinmonks is a technology-focused publication embracing decentralize technologies. We are Non-profit and education is our core value. Learn, Build and thrive. Our other project— https://coinmonks.com, https://cryptofi.co, https://coincodecap.com

胡家維 Hu Kenneth

Written by

撰寫任何事情,O型水瓶混魔羯,咖啡愛好者,Full stack/blockchain developer,Founder of Blockchain&Dapps meetup and Singapore IOTA meetup。

Coinmonks

Coinmonks

Coinmonks is a technology-focused publication embracing decentralize technologies. We are Non-profit and education is our core value. Learn, Build and thrive. Our other project— https://coinmonks.com, https://cryptofi.co, https://coincodecap.com