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):-
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:-
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
- Build Libra client and connect to testnet (it will take some time):-
2. Create 2 accounts, let’s say user A and user B:-
Repeat this above command and it will create another account with index 1
3. To check 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.