We’re excited to introduce the Clarity smart contract language that optimizes for predictability and security. Clarity is currently in developer preview. To get started, check out the documentation and the SDK. We’re seeking feedback from our developer community and welcome any bug reports and pull requests.

Smart contracts allow developers to encode essential business logic on a blockchain. These contracts execute in an open, verifiable, and secure way. There is no need for trusted third parties. Smart contracts are a useful programming paradigm, but they’re only necessary for specific use cases. It’s possible to build many useful applications without ever needing a smart contract. Our amazing developer community has already built more than 140 (and growing!) applications on Blockstack without using any such capability.

Today, we’re taking the first step in enabling smart contract functionality for Blockstack apps by introducing Clarity, the smart contract language for the Stacks blockchains.

Design of Clarity

Much like concurrency primitives, well-designed smart contracts can prevent bugs, but poorly designed contracts, however, can exacerbate hard-to-debug problems. This is especially important given smart contracts manage billions of dollars for people. With Clarity, we took the WYSIWYG — what you see is what you get — approach. Our approach makes it easier to reason about smart contract behavior, cost, and performance.

Clarity is a decidable language. A programming language is decidable if you can know, with certainty, from the code itself what the program will do. Clarity is intentionally Turing incomplete as it avoids “Turing complexity.” This allows for complete static analysis of the entire call graph of a given smart contract. Further, our support for types and type checker can eliminate whole classes of bugs like unintended casts, reentrancy bugs, and reads of uninitialized values. Finally, you can analyze Clarity code for runtime cost and data usage. This empowers developers to predict what a given Clarity program will do, and how much it will cost.

When the DAO was famously hacked, it required a contentious hard fork of the underlying chain to remedy the situation. Bugs like that might have been avoided if a decidable language like Clarity had been used instead. Solidity, the implementation language for the DAO, is an undecidable language: it is impossible to know precisely how a contract will behave in certain situations without actually executing it in those situations. There are advantages to both types of programming languages. But when it comes to smart contracts that lock up billions of dollars in code, it’s critical to minimize risks.

In addition to being a decidable language, Clarity is also interpreted. The contract source code itself is published and executed by blockchain nodes. Removing any intermediate, compiled representation (e.g., EVM byte code for Solidity) further minimizes the surface area for introducing bugs. Publishing the contract source code also optimizes understandability. Compiler bugs are doubly damaging in blockchains because while the programmed source code may not have an error, the eventual program reaching the blockchain could have errors. Any such errors would require contentious hard forks — which are potentially infeasible — to remedy.

Example Clarity Contract

Here’s a Clarity smart contract side-by-side with a contract written in Solidity for Ethereum:

Clarity is a step forward for building apps with features that were not possible in the traditional internet apps. For developers that want to build new apps that #CantBeEvil, Clarity provides precise tools for enabling on-chain logic while reducing unintentional errors.

When you combine reliable smart contracts with apps that can’t be evil and put the user in control, you have an environment for safe experimentation. Predictable smart contracts make it possible for more founders to build great products that users love while minimizing the need for trust. The 140+ Blockstack apps can begin experimenting with smart contract functionality directly in their products.

Docs Clarity SDK

Important Disclaimer:

This communication may be deemed “testing the waters” material under Regulation A under the Securities Act of 1933. We are not under any obligation to complete an offering under Regulation A. We may choose to make an offering to some, but not all, of the people who indicate an interest in investing, and that offering might not be made under Regulation A. We will only be able to make sales after the Securities and Exchange Commission (SEC) has “qualified” the offering statement that we have filed with the SEC. The information in that offering statement will be more complete than the information we are providing now, and could differ in important ways. You must read the documents filed with the SEC before investing.

No money or other consideration is being solicited, and if sent in response, will not be accepted.

No offer to buy the securities can be accepted and no part of the purchase price can be received until the offering statement filed by the company with the SEC has been qualified by the SEC. Any such offer may be withdrawn or revoked, without obligation or commitment of any kind, at any time before notice of acceptance given after the date of qualification.

An indication of interest involves no obligation or commitment of any kind.

Any person interested in investing in any offering of Stacks Tokens should review our disclosures and the publicly filed offering statement relating to that offering, a copy of which is available at www.sec.gov. You may obtain a copy of the preliminary offering circular that is part of that offering statement here.

Blockstack is not registered, licensed or supervised as a broker dealer or investment adviser by the Securities and Exchange Commission (SEC), the Financial Industry Regulatory Authority (FINRA) or any other financial regulatory authority or licensed to provide any financial advice or services.