Developers Guide To LIBRA & MOVE Programming Language!!

Sneha Shukla
Techbootcamps
Published in
9 min readDec 16, 2019

If you’ve been following the tech news, you would have definitely come across the term ‘Libra’ — the blockchain proposed by Facebook. This term may have popped up several questions in your head like what it is, how to use, or develop it. If you want these questions to be answered, then you’re scrolling the right page! This article won’t be utterly technical so that the newbies in blockchain can understand it too. So grab a cup of coffee and warm yourselves up for the reading journey!

If you don’t know anything about blockchain, don’t worry. This article will go through the basics of blockchain, then about Libra blockchain, and Move language so that you can understand this better. Happy reading! :D

Note: If you already know about the basics of blockchain, you may directly jump to the Libra section.

I’ve written only the stuff that is important to know so that the article doesn’t become too long.

What is blockchain?

If you think that it is a chain of blocks, you’re correct! Well, the basic definition is — “Blockchain is a distributed, decentralized, public ledger.” If you didn’t understand any of it, that’s alright because the first time I read it, I thought of it as all jargon, and it made no sense to me as well.

A blockchain consists of multiple blocks strung together, forming a chain. Each block contains a cryptographic hash of the previous block, a timestamp, and transaction data. Blocks on the blockchain not only store data about monetary transactions but also about property exchanges, stocks in a supply chain, and even votes for a candidate.

Blockchains record transactions efficiently and in a verifiable and permanent way. The goal of blockchain is to allow digital information to be recorded and distributed but not edited. The blocks are sealed with a unique identifying code called a hash. The data is distributed across the group of nodes who own a copy of the transactions. That decentralization and synchronization mean no single node (nodes are computers that represent an individual or entity on a blockchain-based network) controls the data. They follow particular protocols for inter-node communication and validating new blocks. Nodes that validate transactions are referred to as ‘mining nodes,’ and they secure the network by ensuring that only correctly formed transactions and blocks are included on the blockchain. This process is known as reaching consensus. Once recorded, the data in any given block cannot be altered without the alteration of all subsequent blocks, which again requires a consensus of the network majority.

For a block to be added to the blockchain, four things must happen:

1. A transaction must occur.

2. That transaction must be verified.

3. That transaction must be stored in a block.

4. That block must be given a hash.

There are three main types of blockchain systems:

Types of blockchain

Open/ Public blockchain — They are open source. Anyone on the platform can read data, execute transactions, and participate in the consensus. They are fully decentralized. E.g., Ethereum, Factom.

Private blockchain — This network requires an invitation and must be validated by either the network starter or by a set of rules put in place by the network starter. This strategy places restrictions on who is allowed to participate in the network, and in which transactions. Participants need to obtain an invitation or permission to join. They are typically used in enterprise solutions to solve business cases and underpin corporate software solutions

Consortium blockchains. — This blockchain is a hybrid of public and private blockchains. The consortium blockchain is a system that is ‘semi-private’ and has a controlled user group but works across different organizations. These types of blockchains are semi-decentralized. E.g., Libra.

Since now we know that Libra is a type of Consortium blockchain, I’m sure you want to dig deeper. Go ahead!

Why Consortium blockchain?

A consortium blockchain contains features of both public and private blockchains. They are permissioned blockchains (Nodes require permission); therefore, not everyone can gain access to it. However, permission is not granted to a single entity but a group of approved individuals. Consensus participants of a consortium blockchain are pre-approved nodes on the network. Thus, consortium blockchains possess the security features that aren’t present in public blockchains but aren’t restricted to specific nodes like private ones.

The blockchain consortium can be used by groups of different organizations who work to develop different models by collaborating with each other. This improves workflows, accountability, and transparency among them. Instead of each company building its own solution from scratch, by being part of a blockchain consortium, they share development costs and time with other organizations. This leads to shorter development times and economies of scale, which allows smaller organizations to take advantage of the same systems as the larger ones.

The above figure tells us how the consortium blockchain is good or bad. For now, let us focus on its positive side and see one of the examples of type this type of blockchain that is Libra.

Birth of Libra

An employee of Facebook, Morgan Beller, started working on cryptocurrency and blockchain in 2017 and was the only person working on Facebook’s blockchain initiative. Facebook Vice President David A. Marcus moved from Facebook Messenger to a new blockchain division in May 2018. By February 2019, more than 50 engineers were working on the project.

In May 2019, a confirmation was made by Facebook that they intended to have a cryptocurrency of their own and called them as “GlobalCoin” or “Facebook Coin.” Libra was formally announced on June 18, 2019. Morgan Beller, David Marcus, and Kevin Weil are the founders of Libra.

Okay, that was too much of statistics you don’t really want to remember. Time to know the real stuff…

What is Libra and how does it work?

Libra is a decentralized, consortium blockchain. It serves as an effective medium of exchange of cryptocurrency and has low-volatility. The Libra’s mission is to facilitate a global currency and financial infrastructure to empower billions of people, create a business model that can promote innovation, lower barriers to entry, and enhance access to commercial services.

The Libra Blockchain consists of validators that work together to process transactions and maintain the state of the blockchain. These validators (Members of Libra Association) provide a framework for the governance of the network and the reserve that backs the coin. Initially, the association will consist of a diverse set of founding members of different organizations chosen according to objective participation criteria, including that they have a stake in bootstrapping the Libra ecosystem and investing resources toward its success. Over time, membership eligibility will shift to become completely open and based only on the members’ holdings of Libra.

Libra Core is an open-source prototype which is a global collaborative effort to advance this new ecosystem. The Libra protocol allows a set of validators from different authorities to maintain a database of programmable resources jointly. These resources are owned by different user accounts authenticated by public-key cryptography and follow the rules specified by the developers of these resources. Validators process transactions and interact with each other to reach consensus. Transactions are based on predefined and, in future versions, user-defined smart contracts in a new programming language called Move.

The figure shows the two types of entities that interact using the Libra protocol: (1) validators, which maintain the database and (2) clients, which perform queries on the database and submit transactions to modify it.

The core mechanisms such as the currency and validator membership enable the creation of a unique governance mechanism that builds on the stability and reputation of existing institutions in the early days but transitions to a fully open system over time.

Hey! Still with me? Let us summarize the key points so that we know what it is that we want to store in our permanent memory. :D

Points to note on Libra:

1. It is decentralized and open-source but Facebook and the Libra Association have a large amount of control over the asset and usage.

2. Libra is tied to leading national and currencies and other stable financial assets.

3. It has low volatility.

4. It has unlimited supply and is subject to demand.

5. Initially, they will run on permissioned blockchain hence need approval before mining.

If you have been following me well then you might remember that I mentioned about Move language before. You don’t? It’s okay because you know about it now. Let's see what it is like.

Why Libra is written in Move language?

Move is a safe and flexible programming language for the Libra Blockchain. Move enables to express the Libra currency and governance rules in a precise, understandable, and verifiable manner. It is an executable bytecode language used to implement custom transactions and smart contracts. Move takes into account the concepts of first-class assets,flexibility, safety, and verifiability.

Again some points to store in brain :P

Following are the key features of Move:

1. It defines custom resource types with semantics inspired by linear logic.

2. Resources can never be copied or implicitly discarded; they can only be moved between program storage locations. These safety guarantees are enforced statically by Move’s type system.

3. The resources are ordinary program values and can be stored in data structures, passed as arguments to procedures, and so on.

4. First-class resources are a very general concept that programmers can use not only to implement safe digital assets but also to write correct business logic for wrapping assets and enforcing access control policies.

Advantages of Move over other languages:

Some popular languages such as Bitcoin Script, StrawCoin, and Ethereum Virtual Machine bytecode languages have disadvantages such as:

1. Indirect representation of assets.

An asset is encoded using an integer, but an integer value is not the same thing as an asset. In fact, there is no type or value that represents Bitcoin/Ether/StrawCoin! This makes it awkward and error-prone to write programs that use assets. Patterns such as passing assets into/out of procedures or storing assets in data structures require special language support.

2. Scarcity is not extensible.

The language only represents one scarce asset. Besides, the scarcity protections are hardcoded directly in the language semantics. A programmer that wishes to create a custom asset must carefully reimplement scarcity with no support from the language.

3. Access control is not flexible.

The only access control policy the model enforces is the signature scheme based on the public key. Like the scarcity protections, the access control policy is deeply embedded in the language semantics. It is not obvious how to extend the language to allow programmers to define custom access control policies.

All these cases are improvised in Move. To satisfy these requirements, Move was designed with four key goals in mind: first-class assets, flexibility, safety, and verifiability. The safety and expressivity of Move have enabled us to implement significant parts of the Libra protocol in Move, including Libra coin, transaction processing, and validator management. Though this language is not as much developed as the others, there is a huge scope for improvement and will surely be one of the top blockchain development languages in the near future.

Conclusion:

We read about the basics of blockchain, its types, Libra blockchain, and Move language; about why and how they were developed. I hope this article has clarified the doubts you may have had. If reading this was beneficial to you, then do click on 👏. This will motivate me to write more such articles. Thank you for reading and for having patience! :)

About the author.

Sneha Shukla is a sophomore, pursuing BTech in Electronics and Telecommunication from IIIT Bhubaneswar. She is currently working as an intern at techbootcamps as a technical content writer. She is passionate about Blockchain, space technology, and IoT. She works on front end web development too! Her hobbies are writing Technical Blog and Promoting New and promising Technologies.

--

--