·

DeFi is exploding, but are we building it responsibly?

Posted by
DappRadar

Understanding DeFi fundamentals for developers

$4 billion. That’s the value currently locked in DeFi markets. It will probably be much more by the time you read this. We live in a world where the money locked in DeFi is greater than the GDP of some countries. Let that sink in.

Thus far, this has mainly been achieved using Solidity, currently the world’s most popular smart contract language. It’s also largely been done on Ethereum, or Ethereum-based protocols and ERC-20 tokens.

The good: A rapidly growing DeFi world and overall appetite for Bitcoin and other cryptocurrencies may lead to more developer activity around smart contracts and interest from users, fueling further innovation.

But, as we revel in the excitement of the current market, it’s important we don’t lose sight of the fundamentals upon which we are building. Even Ethereum’s founder, Vitalik Buterin says users are ‘underestimating smart contract risk’ and that he is ‘not confident that even audited platforms and protocols could guarantee that they wouldn’t ‘break’ within a set period of time by a set percentage margin’. 

All this while major exploits resulting in millions of dollars lost persist.

This has all been concerning for teams at Blockstack PBC and Algorand, who want to help the smart contract industry mature beyond its current state. The new Clarity smart contract language takes on some of the fundamental design issues they see in smart contracts today:

  1. The complexity of smart contract languages has led to unintended security vulnerabilities resulting in immense damage to users.
  2. New protocols and networks suffer from the bootstrapping problem, demonstrating minimal initial participation, and using centralization as a band-aid. 
  3. In order to find flexibility, developers may end up creating new blockchains, trying various forms of wrapping, or use protocols that allow for more flexibility, often at the expense of security.

Gaining Clarity

With Clarity, the goal was to make developers feel confident and safe, as well as protect users. The logical solution was to anchor to the most secure foundation available today: Bitcoin. 

With Clarity (and really the entire Stacks 2.0 blockchain), they want to give developers smart contract tools for Bitcoin, without modifying Bitcoin itself.

The design approach is to make everything that’s needed in a complete smart contract language native, including communication with the underlying blockchain. This is allowed for on the Stacks 2.0 blockchain via Proof-of-Transfer, anchoring Clarity smart contracts directly to Bitcoin.

Anchoring the state of Clarity’s interpreter to the state of the Bitcoin blockchain makes it straightforward and inexpensive to write smart contracts that execute based on Bitcoin transactions.  Because the Stacks 2.0 blockchain has direct access to Bitcoin blocks, Clarity smart contracts can validate and take action on Bitcoin transactions without needing an intermediate BTC-wrapping system, and without needing a set of relayers. 

This makes Clarity smart contracts that deal with Bitcoin more trustless than the alternative wrapping approaches — tricking these smart contracts into accepting a non-existent Bitcoin transaction is at least as hard as attacking Bitcoin, whereas in wrapped approaches, an attacker only needs to corrupt the relayers.

The end result is the ability to write flexible smart contracts backed by the security of Bitcoin and further freedom to innovate in Web 3.0. Clarity is designed to make working with smart contracts better and safer for developers. In fact, the entire language, which is based on LISP, optimizes for predictability, and security. Unlike Ethereum’s Solidity language, Clarity is decidable and intentionally not Turing complete.

This means you can know with certainty what the program will do before executing it. It may be surprising to many, especially considering how much money is locked in smart contracts, that it’s actually impossible to know exactly how a smart contract written in Solidity will behave without first executing it.

You can join Blockstack’s Clarity Hack today and win prizes for building with Clarity.  Learn more & Register

By developers, for developers

Clarity is also interpreted, and not compiled. The contract source code itself is published and executed by blockchain nodes. What you see is what you get. This removes any intermediate, compiled representation (e.g., EVM byte code for Solidity), further minimizing 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.

After years observing the benefits and shortcomings of each smart contracting implementation in the wild, they’re excited to have you try Clarity, which they say was engineered by devs, for devs. 

It eliminates whole classes of bugs like unintended casts, reentrancy, and reads of uninitialized values. Ethereum ‘The DAO’ hack? Impossible. Parity Multi-Sig exploit? Nope. 

Randomness is easy due to an accessible Verifiable Random Function (VRF) baked into the core of Stacks 2.0 that could only be biased by attacking Bitcoin itself. Timestamping is simple: Stacks blocks and Bitcoin blocks are always in sync. 

In the wild

The Blockstack community has already begun sinking their teeth into Clarity, and it’s resulted in some heavy-duty smart contracts already. A Blockstacker put together Swapr, a trustless token exchange similar to Uniswap that brings efficient token trading to Stacks 2.0. A property rental smart contract powered by Clarity removes the need for a trusted intermediary and there’s already a Clarity election contract that completely automates the complex process. 

There is always a balance between complexity and security, power and speed, efficiency, and functionality. With Clarity, we might finally have a flexible smart contract language that responsibly balances all these concerns as we head into what looks to be another wave of exciting growth in the industry.

Blockstack just kicked off the Stacks 2.0 Hackathon Series, a non-stop set of virtual hackathons. Starting off with Clarity Hack, hackers will have the chance to win over $8k in prizes for submitting various types of smart contracts. Clarity makes it simple to put business logic on the blockchain and enable a dapp ecosystem on Stacks. Sign up for the hackathon now on the DevPost Clarity Hack listing! [Clarity Hack Official Rules]

Looking for more developer resources and articles? The all-new DappRadar Developer Dashboard has you covered.

Newsletter

Share this post on social media

Share this Article

Related articles

Related articles

Twitter hack: What just happened?

A wake up call for centralized platforms
© 2018-2020 DappRadar, UAB