Blockstream is introducing Simplicity, a new programming language for blockchain-based smart contracts, intended for inclusion in Blockstream’s sidechains and eventually in Bitcoin. The new language was presented by its creator, Russell O'Connor, Infrastructure Tech Developer at Blockstream, at the ACM SIGSAC Workshop on Programming Languages and Analysis for Security (PLAS 2017).
"Simplicity is a blockchain programming language that is so simple, it fits on a t-shirt,” O'Connor told Bitcoin Magazine. “It is critical that smart contracts behave in ways that all participants expect, and applying formal verification to Simplicity allows us to achieve that.”
Simplicity is still a Blockstream Research & Development project, but there’s potential for its use in Blockstream products in the future, according to the company’s announcement.
“Simplicity is flexible enough that I anticipate many new, domain-specific, languages will generate Simplicity, and this will give users the freedom to generate smart contracts using the tools that most suit their needs," added O'Connor.
O'Connor’s paper, titled “Simplicity: A New Language for Blockchains,” presents Simplicity as “a new programming language, designed to be used for cryptocurrencies and blockchain applications, which aims to improve upon existing cryptocurrency languages, such as Bitcoin Script and Ethereum’s EVM [virtual machine], while avoiding some of the problems they face.”
Bitcoin script is limited by design and unsuitable for complex smart contracts that need more than a small set of simple templates to perform tasks like digital signature verification. Ethereum, on the other hand, includes a more expressive and flexible, Turing-complete programming language, which allows for arbitrarily complex smart-contracts in principle.
But, in practice, Ethereum doesn’t support static analysis to pre-determine the computing resources that a program will require and, thus, filter out too costly contracts and infinite loops. Therefore, pre-paid “gas” fees are lost when an Ethereum program “runs out of gas.” The simpler Bitcoin scripting, which supports static analysis, doesn’t present similar issues.
In a post to the bitcoin-dev mailing list, O'Connor proposed Simplicity as an alternative to Bitcoin Script, noting that static analysis is important for both node operators and for Simplicity program designers.
“Static analysis is a technique that provides a universal algorithm to determine how much any Simplicity program will cost to run before you stake your money on it,” O'Connor told Bitcoin Magazine.
Simplicity can be seen as a more flexible alternative to Bitcoin scripting, not Turing-complete but expressive enough to build useful smart contracts for blockchain applications, or as an alternative to Ethereum, which will support static analysis and other desirable features including improved safety, formal semantics, and Merkelized Abstract Syntax Trees (MASTs).
While Simplicity is intended as a low-level language for smart contracts, O’Connor envisages the possibility of compiling programs written in higher-level languages (like Ethereum’s Solidity) to Simplicity.
“Ivy and the Σ-State Authentication Language are existing programming language development efforts that may be suitable for being compiled to Simplicity,” notes O’Connor in the paper. “For the time being, generating Simplicity with our [Haskell] and [Coq] libraries is possible.”
The next step in Simplicity’s development will be a bare-bones SDK (Software Developer Kit) that will include formal semantics and correctness proofs in Coq, a Haskell implementation for constructing Simplicity programs and a C interpreter for Simplicity. Then, the new language will be ready for initial deployment in the Elements project, Blockstream’s open-source codebase for sidechains, so that developers can start experimenting with the code.
But, as O’Connor stated on bitcoin-dev, “Only after extensive vetting would it be suitable to consider Simplicity for inclusion in Bitcoin.”