Risk Warning: Beware of illegal fundraising in the name of 'virtual currency' and 'blockchain'. — Five departments including the Banking and Insurance Regulatory Commission
Information
Discover
Search
Login
简中
繁中
English
日本語
한국어
ภาษาไทย
Tiếng Việt
BTC
ETH
HTX
SOL
BNB
View Market
How to run the Libra testnet under Windows
Moni
Odaily资深作者
2019-06-20 12:06
This article is about 2096 words, reading the full article takes about 3 minutes
Let's use Windows Subsystem for Linux (WSL) to learn how to unlock the Libra testnet under the Windows operating system.

This article comes fromMedium, original author: Ibraheem Kolawole Bello

Odaily Translator |

Odaily Translator |

Ever since Facebook released the Libra white paper, everyone has been excited about the Libra blockchain.

Frankly, if you weren’t interested in Facebook’s recently announced Libra blockchain future, you probably wouldn’t be opening this article, would you?

Therefore, the focus of this article is to gain a deep understanding of how the Libra blockchain works and its built-in programming language. For most people, the first task is to try to use the command line system provided by Facebook. interact.

But if you check the relevant development documents, you will find that Facebook only provides users with operation guides that support Linux and macOS, but there are many WINDOWS users in the market, so let us learn about it through Windows Subsystem for Linux (WSL) How to unlock the Libra testnet under the Windows operating system.

If you haven't installed Windows Subsystem for Linux, you can first follow the instructions to install it.

You should now have a terminal similar to the one shown below on your WINDOWS operating system:

sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade

Run the following commands to update and upgrade your distribution system.

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

Next, clone the Libra Core Repository with the following command

cd libra

./scripts/dev_setup.sh

To set up Libra Core, change to the libra directory and run the install script to install dependencies as follows:

The install script installs rustup, CMake, protoc and Go.

At this time, you may encounter version problems of rustup and protoc, so what needs to be reminded here is that you need to operate protoc of version 3.6.0 or later.

Run rustup update in the terminal, and export $HOME/.cargo/bin to the path in your .bashrc if the command is not found.

You can reload it with source .bashrc so you don't have to log out and back in.

PROTOC_ZIP=protoc-3.7.1-linux-x86_64.zip

curl -OL https://github.com/google/protobuf/releases/download/v3.7.1/$PROTOC_ZIP

sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc

sudo unzip -o $PROTOC_ZIP -d /usr/local include/*

rm -f $PROTOC_ZIP

Once complete, re-run the setup script ./scripts/dev_setup.sh again. At this point, you should no longer face any installation issues.

secondary title

Build the Libra client and connect to the testnet

./scripts/cli/start_cli_testnet.sh

To connect to a validator node running on the Libra testnet, you need to run the client command as follows:

This command builds and runs the client using cargo (Rust's packaging manager), and connects the client to a validator node on the testnet.

Doesn't it feel great!

secondary title

Next, let's submit our first transaction

Before submitting the transaction, we will create some accounts that will be used later. Thankfully, CLI commands make it easy to create accounts. If you're looking for help with entering your account, you can refer to the following:

Enter the account create command to create an account.

Create a second account using the same command.

Using the account list command allows us to view a list of created accounts

An account's sequence number indicates the number of transactions sent from that account.

secondary title

Next, let's add Libra Coin to the account we created on the testnet

Mint Libra and add to our accounts with account mint 0 100

  • Execute the command account mint 0 100 to mine Libra tokens and add the tokens to our account

  • 0 is the index of the first account created

100 is the amount of Libra tokens to add to the account

  • For the second account, we execute the command account mint 1 20

  • 1 is the index of the second account created

20 is the amount of Libra tokens to add to the account

Please note that when submitting a transaction request, it means that the request has been successfully added to a validator node memory pool (mempool) of the test network, but it does not mean that the request will be successfully completed. Later, we will check the account balance to confirm whether these tokens were successfully mined.

In fact, a successful account mint command also creates our account on the blockchain.

To check the balance in an account, enter the following command: query balance 0

  • We can use the transfer 0 1 25 command to transfer our funds

  • 0 is the index of the first account created

  • 1 is the index of the second account created

25 is the number of Libra tokens transferred.

After the transfer is completed, you can check our account balance.

Libra
Welcome to Join Odaily Official Community