FEBRUARY 25, 2021
Winners: Stacks 2.0 Mainnet Clarity Smart Contract Challenge
by Joe Bender on February 25, 2021
On January 14th, the Stacks 2.0 blockchain was officially launched and marked a huge milestone on the journey to building Web 3.0 on Bitcoin. To celebrate the launch of mainnet, we wanted to give developers an immediate opportunity to dive into Stacks tech with the Stacks 2.0 Mainnet Smart Contract Challenge!

The testnet training wheels came off, and hackers had an entire month to sharpen their Clarity skills and crank out some truly substantial smart contracts. In order to keep the challenge accessible to all technical skill levels, there were also two categories of contract difficulty (Basic & Advanced). Excitingly, this is also one of the first bounties that will be paid out in the native STX token! Our rockstar panel of community judges combed the projects with a fine-tooth comb, and are excited to share details from some of their favorites.
Category: Advanced
ArkadikoDAO
ArkadikoDAO is a DAO inspired by Ethereum’s MakerDAO and implements a stablecoin called Arkadiko ($DIKO) and a governance token called Somos ($ARE). In order to mint $DIKO, you need to over-collateralise Stacks ($STX) tokens into the Arkadiko Stacks Reserve. The collateralisation ratio will be defined by a risk parameter decided upon by the community.

We’re beginning to see exceptionally robust decentralized finance (DeFi) applications be built on Stacks, and the connection to the Bitcoin network gives developers even more power in the platforms they create. There are also two ground-breaking innovations implemented in ArkadikoDAO: a stablecoin, and market-making. Stablecoins are absolutely paramount in crypto as a creative way to mitigate risk and volatility of crypto assets. Establishing stablecoin standards on Stacks will only grow the ecosystem and encourage stability. Additionally, having the ability for STX holders to market make, and put their crypto to work, provides even more opportunities for value creation and passive income.

If anything signals the Stacks developer ecosystem is leveling-up, it’s production-grade smart contracts like ArkadikoDAO. We’re transitioning away from lil’ code snippets demonstrating the power of Clarity, to complex contract suites enabling entire use cases like CDPs or price-stable assets.

View on Github
Category: Basic
Clarity Magic 8 Ball
Author: Daniel Zhou
For all you superstitious blockchainers out there, this brand new Clarity magic 8-ball contract is sure to answer all your burning questions! Inspired by a traditional coin-flip mechanism, this submission will randomly return one of eight responses depending on the blockchain height. This developer defined buffers for each of the options, and used the core Stacks protocol to inject randomness.

View on Github
Category: Basic
Clarity Turnstile
Author: Daniel Zhou
A turnstile might evoke an image of a crowded, dirty subway station in NYC, with throngs of people streaming through the shiny, metal bottleneck. Regardless of its use in the most uncomfortable of public places, a turnstile is actually an extremely important, functional mechanism for flow control.

One hacker took the turnstile out of the subway, and into the blockchain. Clarity Turnstile is a contract for a coin-based turnstile finite state machine (FSM). A simple but elegant implementation, this contract will 'lock' or 'unlock' based on if a coin has been 'inserted' into the program. It's always intriguing to see real-world utilities converted into blockchain software! Not even the most skilled turnstile-jumpers can avoid this fare…

View on Github
Category: Advanced
Clarity Prediction Market
Author: Zafer Ozsoy
Prediction markets have gained significant traction in the blockchain space, as they’re perfect demonstrations of how crowdsourcing knowledge can the most reliable method of collection. Markets are opened on anything and everything, from the results of an election to the price of Bitcoin at a particular date & time. Using decentralized infrastructure to facilitate prediction markets is an ideal utilization of its privacy, security, and immutability.

The Clarity Prediction Market uses a map to store data on the market’s question, balance, total votes, and the owner of the market. There are also maps to store the number of ‘yes’ and ‘no’ votes. By simply calling the createMarket method, a user can submit a market of their choosing to the platform for others to join.

View on Github
Check out some of the other Clarity smart contracts submitted to the challenge:
Clarity Faucet
Author: Zafer Ozsoy
Category: Basic
Simple faucet that can be funded by anyone and will pay out only once to each STX address.

View on Github
Higher or Lower - Guessing Game
Author: Zafer Ozsoy
Category: Basic
A higher or lower guessing game. User calls the contract with a number and "higher” or ”lower". It's compared to a pre-calculated value and if they are right, they win half of the smart contract balance.

View on Github
Rock, Paper, Scissors
Author: Daniel Zhou
Category: Basic
A smart contract for determining the winner between two players in a game of rock paper scissors.

View on Github
Clarity Agreement
Author: Daniel Zhou
Category: Basic
A contract for determining if two parties are in agreement. Only the principal of each party can change the decision or change the party principal to another address.

View on Github
Clarity Compound Interest
Author: Daniel Zhou
Category: Basic
A Clarity smart contract for calculating compound interest.

View on Github
BMI Calculator
Author: Lyle Davids
Category: Basic
A Clarity smart contract for calculating BMI (Body Mass Index).

View on Github
Joe Bender
Hiro PBC
Joe grew up in Pittsburgh, Pennsylvania, receiving his Masters in Information Science from the University of Pittsburgh. After gaining an interest in blockchain technology and cryptocurrencies in 2016, he moved to New York City and joined ConsenSys to work on Ethereum. Joe joined Blockstack as a Developer Evangelist in April 2020, looking to spread awareness of the technology and empower developers to build powerful decentralized applications. His favorite thing about the blockchain ecosystem is the passionate, thriving community full of eclectic, ambitious thinkers.