On Libra
Facebook announced it’s open-source Libra Blockchain and cryptocurrency today in it’s efforts to create a global financial transaction system. This is a game changer. One of the largest companies in the world just launched their own cryptocurrency and it will not be the last. Facebook is taking advantage of a decade of innovation and built on the learnings and innovation of other crypto protocols for state transitions, networking and consensus. It also comes without a lot of the technical debt that other projects have. It is a public yet centralized cryptocurrency and from a regulatory standpoint it is yet to be determined how regulators and central banks react to the new financial protocol.
Libra’s mission is to enable a simple global currency and financial infrastructure that empowers billions of people.
The Libra protocol is a deterministic state machine that stores data in a versioned database.
Libra Stablecoin
Libra (LBR) is a stablecoin and uses this account based model similar to Ethereum for payments and gas fees across a number of validators maintaining the ledger. The ledger state, or global state of the Libra Blockchain, is comprised of the state of all accounts in the blockchain. Libra Core is a permissioned blockchain network with a set of validators hosting replicas of the network consisting of financial institutions, software incumbents and others. It is backed by a reserve of assets and it is governed by the independent Libra Association. To be a validator node for the Libra Association, it is a requirement to invest in the reserve. They have raised $100 million USD.
LibraCore
The system consist of a Blockchain VM called Libra Core written in Rust. It has very similar account model and transaction system as Ethereum while maintaining a modular and type safe smart contract language called Move. Lastly, it has it’s own consensus algorithm called LibraBFT.
2019-06-18 11_57_55-Network · Libra
It uses 32byte keys for account keys and it is using SHA3-256 for the main hash function. For the networking component it is using a combination of technologies in it’s own version similar to libp2p:
Multiaddr scheme for peer addressing. TCP for reliable transport. Noise for authentication and full end-to-end encryption. Yamux for multiplexing substreams over a single connection; and Push-style gossip for peer discovery. They use a sparse Merkle tree that represents ledger state and the storage module uses RocksDB as its physical storage engine.
LibraBFT Consensus
LibraBFT is a consensus algorithm that is based on HotStuff, of the same family as Tendermint and PBFT.
In LibraBFT, validators receive transactions from clients and share them with each other through a shared mempool protocol. The LibraBFT protocol then proceeds in a sequence of rounds. In each round, a validator takes the role of leader and proposes a block of transactions to extend a certified sequence of blocks (see quorum certificates below) that contain the full previous transaction history. A validator receives the proposed block and checks their voting rules to determine if it should vote for certifying this block. These simple rules ensure the safety of LibraBFT — and their implementation can be cleanly separated and audited. If the validator intends to vote for this block, it executes the block’s transactions speculatively and without external effect. This results in the computation of an authenticator for the database that results from the execution of the block. The validator then sends a signed vote for the block and the database authenticator to the leader. The leader gathers these votes to form a quorum certificate that provides evidence of \ge≥ 2f + 1 votes for this block and broadcasts the quorum certificate to all validators.
Move
Move is similar to an adaptation of Rust and C++ move. It is a scripting language for transactions and modules that is used by clients to make updates to the key-value ledger state. It is also to be used for governance and validator membership.
The MoveVM is a stack machine with a static type system.
0x0.LibraAccount
0x0.LibraCoin
Are examples of Modules used for transactions in the example below:
// Multiple payee example. This is written in a slightly verbose way to
// emphasize the ability to split a LibraCoin.T
resource. The more concise
// way would be to use multiple calls to LibraAccount.withdraw_from_sender
.
import 0x0.LibraAccount; import 0x0.LibraCoin; main(payee1: address, amount1: u64, payee2: address, amount2: u64) { let coin1: R#LibraCoin.T; let coin2: R#LibraCoin.T; let total: u64;
total = move(amount1) + copy(amount2);
coin1 = LibraAccount.withdraw_from_sender(move(total));
// This mutates coin1
, which now has value amount1
.
// coin2
has value amount2
.
coin2 = LibraCoin.withdraw(&mut coin1, move(amount2));
// Perform the payments LibraAccount.deposit(move(payee1), move(coin1)); LibraAccount.deposit(move(payee2), move(coin2)); return; } Interestingly they don’t necessarily define the scripting for assets but rather for resources.
Move internalizes the idea of memory ownership and borrowing, very similar to how Rust operates. However, the novelty of the Move language is the way in which a ‘resource’ is defined.
A ‘resource’ is a structure datatype that utilizes the ownership model, but can never be copied only moved and borrowed.
Distribution
Facebook has distribution. The best distribution in the world due to it’s ownership of messaging applications, Oculus, social media platforms. Billions of users. The blockchain and cryptocurrency race has just started.