The Libra Blockchain: Technical Overview [Part I]

Rafael Belchior
Towards Data Science
6 min readNov 22, 2019

--

I am a 🇵🇹 PhD researcher @ Técnico Lisboa, where I teach User Centered Design. I am being a mentor at the Hyperledger Fabric Based Access Control project, supported and funded by Hyperledger and the Linux Foundation 🔥.

Currently, I am a blockchain developer at the Portuguese Government. I am willing to cooperate and discuss the blockchain technology 🚀:

If you like blockchain and open source, be sure to check my Github page (https://github.com/sponsors/RafaelAPB/dashboard) 🙏

This article assumes you have basic knowledge of blockchain technology. If you do not, make sure to check a simple yet comprehensive introduction to this technology here. In part 1, we introduce basilar concepts to the Libra Blockchain, including transaction, events, and ledger history. Next, I provide insights into the Libra Protocol. This summary is based on Libra’s developer whitepaper.

A Brief Introduction ⛓️

“The Libra Blockchain is a decentralized, programmable database designed to support a low-volatility cryptocurrency that will have the ability to serve as an efficient medium of exchange for billions of people around the world”. That is the first sentence of the Libra Blockchain paper [Amsden et al., 2019], wrote by several researchers at Calibra, a subsidiary of Facebook.

The main goal of Libra is to provide reliable, cheap, and seamless financial services (including but not limited to transferring and receiving money). These goals are achieved by creating a global currency — Libra — controlled by the founding members, which are private companies.

Those form the Libra Association. With time, the validation process will depend on the members’ holdings, rather than on the founding members.

The Libra protocol powers the Libra blockchain.

The implementation of the Libra protocol is the Libra Core project. Libra is a public blockchain, with its programming language, Move. In Libra, everyone can see the state of the ledger, and participate in the network, by issuing transactions.

In the Libra Blockchain, a “transaction is an authenticated wrapper around a Move bytecode program”. Transactions act on the current state of the ledger and produce a new state if they are successfully executed.

An example: Rafael transfers 5 Libra from his account to Técnico’s Lisboa account. Note that, like in Ethereum, transactions cost a gas fee. Transactions can also generate events that are queryable by clients. That allows a client to query the blockchain, for instance: “What payments did I receive in the last day?” or “Which payments did Cristiano Ronaldo receive in the last minute?”.

The transaction structure is as it follows:

The sender address includes the sequence number, authentication key and balance from the built-in LibraAccount

The sender public key hash is compared with the authentication key, to prevent the Move Virtual Machine from accepting a transaction from a valid signature, but not associated with an account.

The transaction includes Move bytecode script to execute (program), which has a specified gas price. The maximum gas price puts a threshold on the amount of gas that can be spent on that transaction. The sequence number protects against replay attacks, i.e., assures that a transaction is executed once.

Transactions are signed with the sender’s private key and can be validated with its public key.

Although any client can participate in the network, clients have to be authenticated (through a pivate-public key pair). In the Libra blockchain, validator nodes hold and decide a database of programmable resources, which are owned by user’s (through a wallet app, for instance).

Such programmable resources can be, for instance, Libra (the cryptocurrency associated with the Libra blockchain), or custom resources, programmed through smart contracts.

Unlike Ethereum, this blockchain is a consortium blockchain, which means that validator node — the ones which process transactions issued by smart-contracts, belong to a consortium of companies.

In practice, validators decide on the state of the ledger, and on which transactions are valid. This fact imposes a risk towards decentralization, as members of the consortium can collude in a more natural way to decide about the state of the shared ledger.

How does it work?

The figure above depicts Libra’s protocol overview. The leader contains programmable resources, which can be owned by clients. Such resources are assigned to a module.

For instance, the Libra coin, a programmable built-in resource, inherits rules from the Libra coin module. Validators agree on the state of the shared ledger, via a consensus algorithm, by validating transactions issued by clients and validators.

All validators execute transactions, leading to a new state. When clients query the blockchain for the new state, they retrieved the newest state, which has been signed by the consensus protocol.

The state history is public and, therefore, can be verified by any client. The blockchain thus provides traceability and transparency.

Such protocol allows the ecosystem to agree on the state of the ledger. The state of the ledger corresponds to information about the amount of Libra of each user. How? The state is a key-value store, in which to a specific user address, one or more account values are associated. Account values can be Libra, or other programmable resource — which means you can hold several kinds of tokens.

The concept of account values allows innovators to leverage the Libra blockchain to create new services, which can be bound to a specific kind of value explicitly on the smart contract.

The figure above depicts Libra’s protocol overview. The leader contains programmable resources, which can be owned by clients. Such resources are assigned to a module. For instance, the Libra coin, a built-in programmable resource, inherits rules from the Libra coin module. Validators agree on the state of the shared ledger, via a consensus algorithm, by validating transactions issued by clients and validators.

All validators execute transactions, leading to a new state. When clients query the blockchain for the new state, they retrieved the newest state, which has been signed by the consensus protocol.

The state history is public and, therefore, can be verified by any client. The blockchain thus provides traceability and transparency.

Such protocol allows the ecosystem to agree on the state of the ledger. The state of the ledger corresponds to information about the amount of Libra of each user. How? The state is a key-value store, in which to a specific user address, one or more account values are associated.

Account values can be Libra, or another programmable resource — which means you can hold several kinds of tokens.

The concept of account values allows to innovators to leverage the Libra blockchain to create new services, which can be bound to a specific kind of value explicit on the smart contract.

Can I create my token?

Resources are organized into modules; users can own that. Such modules have a location and can define several resources and procedures. Resources can be tokens used for financial purposes.

Its logic is implemented on the procedures (we could make an analogy with the Ethereum smart contracts or Hyperledger Fabric chaincode).

Unfortunately, at least for now, clients will not be able to create custom resources, such as modules.

In this article, we covered the Libra essentials. In the next article, I will show you how to set up the Libra blockchain on your computer.

Thanks very much for reading. You Rock đź’Ş

--

--

R&D Engineer at Blockdaemon. Opinions and articles are my own and do not necessarily reflect the view of my employer. https://rafaelapb.github.io