Move, by Libra, and Cadence, by Flow, are the first two resource-oriented programming languages available to smart contract developers. The teams are now engaged in open source collaboration to ensure both communities can benefit.
One of the most exciting components of Facebook’s work on the Libra blockchain has been Move, a new smart contract language designed from the ground up for a crypto-enabled world.
Move is built around the idea of “resources”, a new kind of data structure inspired by linear types. Resources are the first programming language construct that allows programmers to indicate to the compiler and runtime that certain data in the program represents valuable digital assets and should be protected: It enforces rules, in the language itself, about how these assets can be created, ensures they can’t accidentally be deleted or “dropped”, and requires they are never copied, only moved (inspiring the language’s name).
The Flow blockchain introduces its own language, Cadence, that is also resource-oriented. Like Move, Cadence enforces careful rules about how resource assets are managed, and is built with security and reliability as some of the most important considerations in how the language is structured.
The two languages are complements: Move was designed “bottom up”, with a focus on performance and efficiency. It has a compact bytecode that can be efficiently executed, leading to high scalability. However, the syntax is minimal, designed for machines first and humans second.
Cadence on the other hand was designed “top down”, with an emphasis on readability and clarity. It uses a familiar syntax inspired by Rust and Swift, with a strong, static type system to minimize runtime errors. All methods, interfaces, and transactions can include pre- and post-conditions to enforce expected behaviour (“design by contract”). This results in a language that is easier to learn, significantly easier to audit, and ultimately much more productive than any current alternatives.
Cadence is currently an interpreted language, but we're excited to say we have been working with the Move team to find a way to compile Cadence down to Move bytecode for execution on the Move virtual machine.
The possibilities here are immense for both communities. If we succeed, the Move virtual machine would power both the Libra and Flow blockchains, and Cadence code could target either blockchain; a fast and easy-to-use language that leverages the power of resource-oriented programming.
To be clear, as blockchains, Libra and Flow are built for different purposes. Flow is designed to be fully permissionless and decentralized, supporting participation by anyone with an internet connection. As a result, both Cadence and Move will be fully unconstrained on Flow, allowing for a Turing-complete smart contract environment.
Intrigued?
There’s so much more about Flow that is different, starting with the architecture. Unlike most other blockchains, including Bitcoin, Libra, and Ethereum, Flow has a novel four-node architecture. Flow divides the work of processing a transaction and validating a block into four different steps, each handled by a different validator node role. This architecture is outlined in our first technical paper: Flow: Separating Consensus and Compute.
The separation of concerns in this multi-role design dramatically improves the performance of the network without breaking atomicity through sharding or so-called “layer two” solutions — or reducing decentralization by limiting participation. As a result, smart contracts and user accounts on Flow can always interact with each other in one atomic, consistent, isolated, and durable (ACID) transaction.
In other words: all applications on Flow run in the same shared global execution state and benefit from full composability. To learn more:
- Click around on the main site: onflow.org
- Join discord and introduce yourself: chat.onflow.org
- Start writing contracts on Playground: play.onflow.org