How to setup Libra blockchain testnet?

Naveen Agarwal
Jul 10, 2019 · 5 min read
Libra blockchain testnet

Introduction

Facebook’s new stablecoin Libra is going to work in three parts; these three parts are going to work together in collaboration to form a more inclusive financial system:
· secure, scalable and reliable blockchain;

· backed by a basket of assets to give it balanced value;

· governed by an independent Libra association which will work to evolve the ecosystem.

With the stablecoin, Facebook has also introduced a Libra blockchain which is a decentralized, programmable database. The blockchain is designed to support a long-only cryptocurrency that can be exchanged around the world.

Setup Libra Blockchain Client

As per the official documentation, Libra blockchain client is currently only available for Linux(Red hat or Debian) or Mac Osx. Hence to make it platform independent, we are using docker with Debian base image.
We are assuming that docker is installed on system if not, then install it by visiting this link:- https://docs.docker.com/install/ .
Once the installation is complete, follow the instructions based on operating system. In case you don’t want to install dependencies manually, we have created a docker composer file, using that your docker will set up automatically, or run the process by finding the title “Using Docker Composer” below.

1. First of all we need to pull base image of Debian in docker:-


docker pull debian

2. Now we need to run the container:-

docker run -d -i debian

3. Go inside the docker container to install Libra blockchain dependencies (find your container id, by running this command “docker ps”):-

docker exec -it <containr id> bash

4. Install git, curl and build tools:-

apt updateapt install -y gitapt install -y curlapt install -y build-essential

5. Install CMAKE:-

apt install -y wgetwget https://github.com/Kitware/CMake/releases/download/v3.14.5/cmake-3.14.5.tar.gztar xzf cmake-3.14.5.tar.gzcd cmake-3.14.5./configure — prefix=/opt/cmakemakemake installmkdir /usr/local/share/cmake-3.14cp -r /opt/cmake/share/cmake-3.14/* /usr/local/share/cmake-3.14/

6. Install GO Lang:-

curl -O https://dl.google.com/go/go1.10.2.linux-amd64.tar.gztar xvf go1.10.2.linux-amd64.tar.gzmv go /usr/local

7. Install Protocol:-

apt install -y autoconf libtoolgit clone https://github.com/protocolbuffers/protobuf.gitcd protobufgit submodule update — init — recursive./autogen.sh./configuremakemake checkmake installldconfig

8. Clone Libra from git:-

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

9. Setup Libra Core (it will download components, hence will take some time):-

cd libra./scripts/dev_setup.sh

Using Docker Composer

Please find docker composer file using this link https://github.com/aceoKvelland/libra/blob/master/docker-compose.yml, and download it on your local system. Make sure you have installed docker-composer in your local system, if not then you can install it via: https://docs.docker.com/compose/install/.

After installing docker compose, go to the path, where you have downloaded docker compose file “docker-compose.yml”, and run below command (it will take time, please wait till finish):-

docker-compose up -d

Now, docker container will be created named as “libra-blockchain”, you can check it by running this command:-

docker ps

While we are using docker-compose up -d , its installing dependencies in background, we can check the status of dependencies using this command:-

docker logs <container id>

Test the transactions on Libra Blockchain Testnet

Now, we need to go inside the docker container, so that we can start Libra blockchain Testnet, using this command:-

docker exec -it <containr id> bash
  1. Build Libra client and connect to testnet (it will take some time):-
./scripts/cli/start_cli_testnet.sh

2. Create 2 accounts, let’s say user A and user B:-

account create

Repeat this above command and it will create another account with index 1

3. To check account list:-

account list

Here sequence number is number of transactions what we performed, when you created new accounts, it will show you “0” and status will be “local”. When we create a new account then it is created locally and not on the blockchain, till we perform transaction in those accounts.

4. To add tokens/coins into account A and B:-

account mint 0 100

Here “0” refers to account index and “100” refers to tokens/coins, we can use same command to mint tokens/coins into “B” account, just need to change “0” to “1” because “B” account’s index is “1”. Libra is using “Faucet” to mint tokens/coins on testnet. However, on mainnet it will not work.

5. To check the balance:-

query balance 0

Here “0” refers to account index of “A”.

6. To submit a transaction:-

transfer 0 1 10

Here “0” refers to account “A” and “1” refers to account “B” and “10” refers to number of tokens/coins.

Now we can check balance of both accounts using commands.

The Libra testnet network is set up to generate the address, mint the coins from test faucet and check the account state. Libra blockchain is still in the development stage and is set to launch next year.

Akeo

Official Medium publication for Akeo.Tech focusing on innovation and spreading awareness about technologies that can disrupt current business models. Follow us to get deep insights into blockchain, AI & ML, Fintech, and Industry 4.0. More info at — www.akeo.tech

Naveen Agarwal

Written by

Akeo

Akeo

Official Medium publication for Akeo.Tech focusing on innovation and spreading awareness about technologies that can disrupt current business models. Follow us to get deep insights into blockchain, AI & ML, Fintech, and Industry 4.0. More info at — www.akeo.tech

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade