This blog is now an archive. Find content from Hiro here and Stacks news and announcements here.

Introducing the Winners of Clarity Hack

Meet the winners of the first hackathon in the Stacks 2.0 Hackathon Series

Another hackathon, another round of mind-blowing smart contract submissions from diehard Stacks community developers. Clarity Hack wrapped up this Monday, and our judges have had an absolute blast this week scoring the projects and seeing how hackers have matured as Clarity devs. The first smart contract hackathon in May popped off, and produced a lot of those basic building block contracts that are crucial for dapps: escrow, token exchange, NFTs. For this edition, the community really took the training wheels off and produced powerful, robust smart contracts with real-world applications.

Put your hands together for your Clarity Hack winners!


1st Place ($2,000) – Flexr

Author: Pascal Belloncle

View on Github

The blockchain world has come such a long way since the early days of Bitcoin. First, it was just digital currency with a store of value. Then the ICO boom saw blockchains being used as a crowdfunding killer app. Dapps came out of the woodwork and enabled crazy experiments like CryptoKitties. Now we’ve reached a point where it seems DeFi experiments grow on trees! From basic trustless token exchanges like Uniswap, to complex pseudo-ponzi schemes like FairWin, it’s all a lot to keep up with. But, what started with basic crypto-economic mechanisms like opening a CDP on Maker, has evolved into a vibrant playground of Rubiks Cube-like platforms, chopping up and dishing out crypto like a chef at Benihana.

One of the most recent and interesting projects to emerge in DeFi mania is Ampleforth (AMPL). Most currencies derive their value from the balance of supply and demand. Varying economic conditions such as recessions, booms, and technological advances affect how much currency people want to personally hold. In most cases, the fluctuations in supply and demand are represented in the price of the asset. If the demand for a particular currency is high and the total supply available is low, it will logically result in people willing to pay more for ownership of the asset. Ampleforth identified the volatility in this model, and flipped the architecture on its head.

Ampleforth refers to itself as an adaptive currency. This is because the AMPL protocol automatically adjusts supply in response to demand. When price is high, wallet balances of $AMPL increase. When price is low, wallet balances of $AMPL decrease. In this way, AMPL is non-dilutive. Supply adjustments are applied universally and proportionally across every wallet’s balance. This results in a user’s percent ownership of the network remaining fixed despite their token balance fluctuating. This alleviates an issue in the industry that Ampleforth has labeled as the Diversification Problem. All of the cryptoassets in existence right now are correlated together. This can be extremely dangerous when price movements for a token are a reaction to overall market swings instead of the specific project’s merits and development updates. AMPL’s novel incentive structure allows it to unprecedentedly decouple from Bitcoin’s price pattern. This type of cryptoeconomic framework reduces systematic risk by adding diversity to a notoriously homogeneous market.

*Announcer Voice*: Yoooooooooour back-to-back Blockstack hackathon champion: PSQ!

Congratulations to a friendly face around the Blockstack community as of late, Pascal Belloncle, for bringing home the Clarity Hack crown. He must be super tuned into the DeFi experimentation space right now because not only was he aware of all this new adaptive currency stuff, he went ahead and built it in Clarity!

Meet Flexr. A Stacks 2.0 token with an elastic supply that incentivizes liquidity providers with token rewards and rebases daily based on price Oracle. Flexr is based on the same economics and incentives as the Ampleforth token and Geyser smart faucets. Like Ethereum’s ‘ERC-20’ token standard, Flexr is an ‘SRC-20’ token on the Stacks 2.0 blockchain. However, it also acts like Ampleforth’s APML token in that Flexr is guaranteed by design to be uncorrelated from other tokens. The supply of Flexr token gets adjusted (rebased) on a daily basis based on the price provided by an Oracle.

Another truly awesome part of this submission is that it significantly utilizes a smart contract from the last Clarity hackathon, developed by the same hacker: Swapr. Swapr is an automated token exchange modeled after Uniswap. The Flexr token can then be exchanged with STX on Swapr! Liquidity providers on Swapr are further incentivized by staking the proof that they provided liquidity on a Geyser. This earns liquidity providers higher rewards the longer they keep staking.

It’s also mind-boggling that the implementation of a SRC-20 token was a mere accompaniment to this robust DeFi smart contract! The ERC-20 standard on Ethereum is what caused the digital asset space to explode. It outlined a set of rules for token creation that would allow them to be interoperable across an application ecosystem. A quick glance at the CoinMarketCap top cryptocurrency list will show that the ERC-20 token standard dominates the industry and enabled a cohesive user experience for crypto users. Having that functionality replicated in Clarity smart contracts on Stacks 2.0 is absolutely critical infrastructure. SRC-20 is also a fantastic blueprint for other developers to use as a guide when they dream up their next big idea for Stacks 2.0.

No project excited the judges like Flexr, because it’s the best example of the promising experimentation that is currently happening on the testnet. PSQ ****built a behemoth DeFi machine, and established a token standard, all in a matter of weeks. Adaptive currency, liquidity provider rewards, the SRC20 token trait, rebasing, an oracle contract: all on Stacks 2.0 now thanks to one project 🤯.


2nd Place ($1,500) – Uint256-lib

Author: Anastasia Kondaurova

View on Github

Blockchain can be hard! There are all those pesky numbers, and not just 1s and 0s like everyone talks

about. That gets a lot more complicated when you have to do crazy stuff with those numbers like move em’ around, smash them together, slice them every which way, and this isn’t even mentioning that people’s money depends on those numbers!

Blockstack made some very deliberate design decisions when engineering Clarity and Stacks 2.0 to maximize efficiency and security. Having an unsigned 128-bit integer be the default integer declaration was one sacrifice that streamlined certain aspects of development, but created obstacles in others. 256-bit integers are used abundantly in blockchain code, and an important tool in a developers pocket.

Anastasia probably ran into this exact roadblock in her experience, and took it upon herself to build a workaround for the community! Like a mad genius, she represents a uint256 by declaring it as tuple of four uint64 values.

The library then offers a myriad of super helpful mathematic operations for all your coding desires. The user can perform addition, subtraction, multiplication, division, bitwise shifts, conversions, compare two values, check for zero value or if two values are equal, and even more complex actions. Some of the more basic methods also check if the result of an operation exceeds the 256-bit limit.

This library will undoubtedly become an oasis in the desert for struggling developers going deep into the troubleshooting rabbit-hole. Crafting workarounds from scratch can be time consuming distractions during a development sprint. Having this contract to query on the fly will be a massive benefit when building dApps. A tremendous kudos goes out to this hacker from Blockstack, and the entire community!


3rd Place ($1,000) – Stackstarter

Author: Marvin Janssen

View on Github

Everybody remembers when Kickstarter came on the scene. It seemed like such an innovative idea to allow individuals to crowdfund capital from parties interested in a particular idea or product prototype. This removed intermediaries from process such as venture capitalists that would only provide funding for a percentage of the eventual company. Kickstarter gave the general public unprecedented power, and enabled the creation of card games like Exploding Kittens, a Veronica Mars feature-length film, and a cheaper, modular, consumer-ready 3D printer.

Then how come the blockchain ICO boom of 2017 wasn’t hosted on Kickstarter?! Well it’s due to the fact that Kickstarter is still a centralized company, looking to maximize profits. A quick look at the terms & conditions for Kickstarter reveals that it takes a whopping 5% fee from all the capital that users raise on the platform. Additionally, another 3-5% is taken again as a “payment processing fee”. After hard-working founders and inventors spend their energy at willing an idea into existence, Kickstarter shaves a sizable chunk off the top.

Although Kickstarter isn’t perfect, it really did popularize the idea of using the internet to market ideas to specific demographics that would find it interesting enough to contribute monetary value. That’s why crowdsourcing was a no-brainer when blockchain technology became mature enough facilitate this type of decentralized capital-raise. The initial coin offering craze was basically Kickstarter, for crypto projects, hosted on the blockchain. Using blockchain instead of a Web 2.0 website removes an intermediary and any possibility of a rent-seeker taking a percentage fee from your money! It enabled millions of dollars of funds to be collected quickly, securely, and without a bank, lawyer, venture capitalist, or website.

Marvin Jannsen realized the brilliance of the decentralized crowdfunding architecture, and for this Clarity Hack he brought the functionality to Stacks 2.0! Say hello to Stackstarter, a Clarity Smart contract used for crowdfunding $STX as capital. Everything you could need to manage or administrate an initiative of this nature is right there for you in the code. Public functions allow a user to create a campaign, designate a target fundraise goal in $STX, and set a time duration in # of $STX blocks processed by the chain. The creator of the campaign becomes the owner and is assigned special permissions such as updating the campaign, designating tiers of contribution, refunding contributors if the campaign is canceled, or ultimately collecting the total funds of a successful campaign for use. Participants can then query private, read-only functions to monitor metrics such as total amount contributed, or details about their specific contribution such as the tier they were placed in. One especially unique feature in the contract is the ability for investors to actually withdraw their funds if the campaign goal has not yet been reached. This should give users much more confidence in transacting with the contract, knowing that their funds aren’t permanently locked at the whim of the administrator.

This is such a fundamental mechanism to have available on a network, as crowdfunding was blockchains first ‘killer app’. Ethereum demonstrated that you don’t need VC connections and a flashy pitch deck to excite people with an idea and collect capital. Blockstack wants Stacks 2.0 to be a place where experiments are born, and this type of decentralized funding instrument can enable that. Big shoutout to Marvin for developing this important building block!


Runners-Up:

4th Place ($500) – Clarity Marketplace

Author: Friedger Müffke

View on Github

Marketplaces are one of the oldest human constructs in our society. Since the beginning of time, people have traded, bartered, bought, and sold goods & services in public spaces. The Grand Bazaar in Istanbul has been active since its opening way back in 1455, more than five hundred years before the word blockchain was even invented.

It’s only natural that the marketplace would eventually migrate into a digital format. In Web 2.0, we saw internet storefronts and auction platforms like Ebay, Craigslist, or Amazon achieve success by offering physical goods through a digital catalogue. This was a step in the right direction, but still relied on centralized services to facilitate the transaction. Amazon controls what products are available, Ebay takes a fee, and Craigslist has questionable legitimacy sometimes.

Blockchain enables for the first time a true decentralized, digital marketplace where parties can transact directly without intermediaries. With the advent of digital assets and collectibles, it turns the blockchain marketplace into a thriving economy of virtual goods without the need for trust.

This functionality is now available in a Clarity smart contract thanks to everyone’s favorite Blockstack Bloke, Friedger Müffke! Clarity Marketplace is a set of smart contracts that facilitates the transaction of tradable assets and NFTs on the Stacks 2.0 blockchain. All of the actions you would need to interact with a physical marketplace are available in the smart contracts. The market.clar contract describes the marketplace and outlines rules for handling assets. The tradables.clar file defines the interface (traits) of tradable assets on the platform. One of the assets available is structured from monsters.clar, a simple Tamagotchi-like monster that needs to be fed every 6 blocks.

With these components, a gamification aspect of the platform starts to emerge. That’s because it was modeled after Monstereos, a game on the EOS blockchain where you keep your pet monster alive and battle it against other users. Users must keep their monster alive by feeding it, and can trade for different monsters if they so choose.

Another way Friedger went above and beyond was including simple versions of the smart contracts. This allowed for a stripped-down version of the marketplace, where the only functionality is trading monsters and traits are removed.

This is such integral architecture to have on a blockchain network, as buying, selling, and trading assets is one of the core features of a decentralized system. Adding the ability to submit any NFT to the platform makes it extremely interoperable and a huge incentive for new users. I think everyone is looking forward to bustling digital bazaars on Stacks 2.0, and battling virtual monsters is always a nice bonus. 👹


5th Place ($500) – Clarity Composable Token

Author: Kevin Do

View on Github

Gaming applications are really beginning to gain traction in the blockchain world the last few years. What started as just Cryptokitties has evolved into an extremely active space with genuinely high quality games like Gods Unchained, Decentraland, Crypto Space Commander, Skyweaver, Neon District, and many more.

Video games are typically immensely modular. Virtual experiences are jam-packed with items, apparel, abilities, locations, weapons, and other adventurer’s garb. That’s why blockchains could be the perfect infrastructure for gaming to thrive on. Having the ability to represent items or abilities as NFTs on a blockchain opens up unimaginable possibilities pertaining to rarity, tradability, and portability. No longer does EPIC games own all your Fortnite skins. Blockchain enables decentralized gaming ecosystems, where the player owns their assets, achievements, and collectibles.

This can get very complicated however when a single character can equip a multitude of different items. A hero may need a sword, bow, quiver, shield, horse, and armor all just to defeat that Balrog. If all of those items are represented as digital assets, and need to virtually attached in some way to the character, the code behind the scenes could get extremely complex. If we were to use standalone NFTs, the attachment, detachment, and transferring process would become painful with numerous transactions required. This could have a negative impact on game performance. It get’s even more obfuscated when items can attach to items, and the fire buff gets embedded in the celestial ruby which is placed in the hilt of the ancient sword which is then finally wielded by the character.

This was what motivated Kevin Do to create a new type of token: a composable token. With this composable token, any NFT token can be attached to or detached from any other NFT token at any time. This enables the automatic transfer of whole heroes along with all their attached items in one transaction. Check out the specification below:

Each Composable Token is a NFT token. Each token can have only one parent, but can have many children. Then there are rules to ensure validity, like ensuring the parent must be a different token than the child to avoid recursion attachment. However, the coolest part is that you can specify that when the parent asset is transferred to another user, all of the attached items or effects represented as NFTs come along with it! This type of transaction will be absolutely necessary to streamline the user experience of blockchain gaming. Before it was, “Here lemme send you my mage character! Oh wait hold on now I’m sending the staff, and the crystal that goes in it. Awe man wait I have to send you magic robes too. Crap where did I put my pointy hat…”. Now users can send their character, accompanied by their hard-earned arsenal, all in a single transaction.


6th Place ($500) – rStack

Authors: Mike Cohen, Himanshu Nair, Camiel van der Beek, and Valentin Abrutin

View on Github Visit rStack

Stacking is definitely one of the Stacks 2.0 features the community is most excited about. Proof-of-Transfer enables novel uses for Bitcoin that have never been tried in the wild. The unique incentive structure of Stacking & PoX mining will allow for some truly interesting cryptoeconomic mechanisms using $BTC and $STX. The fact that Stackers can receive rewards in a base currency such as Bitcoin, for locking up their native $STX network tokens, will be alluring for wandering cryptonauts looking for a new chain to call home.

rStack

However, in order to lock up your $STX tokens and receive rewards for stacking, there is a certain participation threshold that must be reached. For example, if 100% of the STX supply is liquid, a participant would need 0.02% (or 1/5000th) of the liquid supply. Unfortunately, all the Blockstackers out there are not going to meet the requirements outlined by the protocol. That’s where a concept called delegation comes into play. Delegation is giving another participant in the network permission to use your tokens in order to pool together, successfully breaching the threshold for participation in Stacking. Then, the Bitcoin received rewards are split proportionally between the parties that banded together.

rStack enables this type of delegated stacking via fraud proof swaps of Lightning BTC to STX tokens using Lightning Service Authentication Tokens (LSAT/402) protocol. Their goal was focused on providing services to help smaller STX token holders participate in PoX. rStack is also a fully decentralized application using Gaia hubs for data storage.

Stacker delegation has been hypothesized since the very beginning, and even has its own section in the PoX whitepaper. Blockstack knew that to empower smaller stacks holders, and to prevent centralization, delegated stacking would be a must-have. Big thanks to the whole rStack team for laying the groundwork.

Also take a look at this phenomenal Stacks 2.0 explainer video that was included with the submission:

 


Best of the Rest:

7th Place ($250) – Stacks Loans

Authors: Armando Cossio, Jose Astrain, Joyce Lozano, Richard Nogales

View on Github Try Stacks Loans

Get a loan by locking up your STX and get the compounding interest up front. Stacks Loan will generate an IOU to unlock your STX once you pay back the loan.


8th Place ($250) – Clarity Provenance

Author: Pradeep Niroula

View on Github

A smart contract that keeps a record of provenance of an asset.


9th Place ($250) – Earn Chain

Author: CG Deviation

View on Github

Inspired by the Ponzi model. Just for demo, not for evil purposes!


10th Place ($250) – Quiz Payout

Author: James Botwina

View on Github

Participants answer a quiz question and deposit funds into the contract. The contract verifies if the participants’ answers are correct and distributes the loser’s deposits.


11th Place ($50) – Supply Chain Asset Tracker

Author: Vitaly Volozhinov

View on Github

Create and transfer assets on the Stacks 2.0 blockchain.


12th Place ($50) – Counter Even/Odd Calculator

Author: AbdulBasit Hakimi

View on Github

Check whether a counter is in an even or odd state.


13th Place ($50) – SplitzPay

Author: Jui Thombre

View on Github

A smart contract to facilitate splitting payment between two or more entities

 


Forward-looking statements

This communication contains forward-looking statements that are based on our beliefs and assumptions and on information currently available to us. In some cases, you can identify forward-looking statements by the following words: “will,” “expect,” “would,” “intend,” “believe,” or other comparable terminology. These statements involve risks, uncertainties, assumptions, and other factors that may cause actual results or performance to be materially different. We cannot assure you that the forward-looking statements will prove to be accurate. These forward-looking statements speak only as of the date hereof. We disclaim any obligation to update these forward-looking statements.

Joe Bender

Joe Bender

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.