Try Facebook library, can bitcoin get on this train

Keywords: Go cmake network github git

White paper highlights

Before starting to play the library test network, draw the key points in the library white paper, such as how to generate coins, how to trade, etc.

Building a simple, borderless currency and financial infrastructure for billions of people

The effect is, for example, if you want to go to the United States and need to order US dollars, you can change RMB into libra currency through institutions, and then change it into US dollars, or directly use libra currency for transactions. It's as simple as mobile payment.

Why do we believe in the libra ry

Guarantee the full use of real asset reserves (referred to as "Libra reserves"), which are supported by a network of trading platforms that buy and sell Libra and have competitive relationships

A large number of assets are required for credit endorsement. Libra association is an independent non-profit membership organization with its headquarters in Geneva, Switzerland. The aim of the association is to coordinate and provide the management framework of network and asset reserve, and take the lead in financing that can produce social influence and provide support for Inclusive Finance.

So the power of this association is huge, if you trust this association. The members of Libra Association will include various enterprises, non-profit organizations, multilateral organizations and academic institutions distributed in different geographical regions

Anyone who owns Libra can get a high degree of assurance that they can convert their digital currency into local currency according to the exchange rate, just as they can convert one currency into another while traveling. This approach is similar to the way other currencies have been introduced in the past: to ensure that they can be used in exchange for real assets, such as gold. The purpose is to help cultivate people's trust in the new currency and realize its wide use in the early stage of its birth. Although Libra will not use gold as a support, it will use a range of low volatility assets (such as cash and government securities provided by stable and reputable central banks) as collateral.

The assets in Libra's reserves will be held by custodian institutions with investment grade credit rating distributed around the world to ensure the safety and dispersion of the assets

Only the Libra association can make (mint) and destroy (burn) Libra

Libra coins will only be manufactured if authorized dealers invest legal assets to buy Libra coins from the association to fully support the new currency. Libra coins will only be destroyed if authorized dealers sell them to the association in exchange for collateral assets.

An important goal of Libra association is to gradually improve the degree of decentralization

The association will gradually realize the non licensed management and consensus of Libra network. The association will strive to initiate this transition within five years, thereby gradually reducing its dependence on founding members. Likewise, as the manager of Libra reserves, Libra Association will strive to minimize its dependence on itself.

Compile

Environmental preparation

The test version of Libra has higher requirements for cmake and proto versions. It is recommended to install these two versions from the source code first. Otherwise, this error may be reported later:

 Compiling grpcio-sys v0.4.4
error: failed to run custom build command for `grpcio-sys v0.4.4`

Caused by:
  process didn't exit successfully: `/root/libra/libra/target/debug/build/grpcio-sys-18712f499919ddc1/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-changed=grpc_wrap.cc
cargo:rerun-if-changed=grpc
cargo:rerun-if-env-changed=GRPCIO_SYS_USE_PKG_CONFIG
cargo:rerun-if-env-changed=CARGO_CFG_TARGET_OS

Install cmake

wget https://github.com/Kitware/CMake/releases/download/v3.16.0-rc3/cmake-3.16.0-rc3.tar.gz
tar zxvf cmake-3.16.0-rc3.tar.gz 
cd cmake-3.16.0-rc3
yum install -y openssl-devel
./configure && make && make install

Install protobuf

yum install -y autoconf
wget https://github.com/google/protobuf/releases/download/v3.6.1/protobuf-all-3.6.1.tar.gz
tar zxvf protobuf-all-3.6.1.tar.gz
./autogen.sh
./configure
make
make install

Compile libra

git clone https://github.com/libra/libra.git
cd libra
git checkout testnet
./scripts/dev_setup.sh

This will help you install go rust. The protoc cmake installed in the script may not work, so it is installed first

Start test network

./scripts/cli/start_cli_testnet.sh

And then you go to the interactive command line

usage: <command> <args>

Use the following commands:

account | a
  Account operations
query | q
  Query operations
transfer | transferb | t | tb
  <sender_account_address>|<sender_account_ref_id> <receiver_account_address>|<receiver_account_ref_id> <number_of_coins> [gas_unit_price (default=0)] [max_gas_amount (default 10000)] Suffix 'b' is for blocking.
  Transfer coins from account to another.
help | h
  Prints this help
quit | q!
  Exit this client


Please, input commands:

libra%

Create account

0 is Alice 1 is Bob

libra% account create
>> Creating/retrieving next account from wallet
Created/retrieved account #0 address 3ed8e5fafae4147b2a105a0be2f81972883441cfaaadf93fc0868e7a0253c4a8

Here the index 0 and a hex account address are returned. 0 is only convenient for you to operate locally

Create another

libra% account create
>> Creating/retrieving next account from wallet
Created/retrieved account #1 address 8337aac709a41fe6be03cad8878a0d4209740b1608f8a81566c9a7d4b95a2ec7

Now you can see two accounts

libra% account list
User account index: 0, address: 3ed8e5fafae4147b2a105a0be2f81972883441cfaaadf93fc0868e7a0253c4a8, sequence number: 0
User account index: 1, address: 8337aac709a41fe6be03cad8878a0d4209740b1608f8a81566c9a7d4b95a2ec7, sequence number: 0

issue coins

Using mint command to "coin" is the same as hairstyle currency. The difference between bitcoin and bitcoin is that bitcoin is "dug out" by calculation, while libra only uses the authority to strike a command...

libra% account mint 0 110
>> Minting coins
Mint request submitted

0 is your account index, 110 is "silver"

Give another 52 dollars to Bob

libra% account mint 1 52
>> Minting coins
Mint request submitted

Query account

libra% query balance 0
Balance is: 110
libra% query balance 1
Balance is: 52

Transfer accounts

First look at the transaction sequence, and add 1 for each transfer out

libra% query sequence 0
>> Getting current sequence number
Sequence number is: 0
libra% query sequence 1
>> Getting current sequence number
Sequence number is: 0

Alice (0) turns ocean 10 to Bob(1)

libra% transfer 0 1 10
>> Transferring
Transaction submitted to validator
To query for transaction status, run: query txn_acc_seq 0 0 <fetch_events=true|false>

And then look at the transaction sequence

libra% query sequence 0
>> Getting current sequence number
Sequence number is: 1
libra% query sequence 1
>> Getting current sequence number
Sequence number is: 0

Accounts of both parties:

libra% query balance 0
Balance is: 100
libra% query balance 1
Balance is: 62

Alice is 10 yuan less, Bob is 10 yuan more

Concluding remarks

The global currency is bound to come, but it's not that libra doesn't know, but the global promotion of libra is bound to suffer great resistance from many countries, which may be a huge currency war in history.

Finally, I wish you all the best in the future~

sealyun QQ group: 98488045

Posted by greenday on Wed, 06 Nov 2019 03:09:25 -0800