Need a crash course on Bitcoin layers?
→ READ OUR FREE GUIDE
Need a crash course on Bitcoin layers?
→ READ OUR FREE GUIDE
Need a crash course on Bitcoin layers?
→ READ OUR FREE GUIDE
Need a crash course on Bitcoin layers?
→ READ OUR FREE GUIDE
Need a crash course on Bitcoin layers?
→ READ OUR FREE GUIDE

3 Examples of Web3 Contracts at Work in Building Apps for Bitcoin

Bitcoin started the blockchain revolution, but it’s more than a crypto asset; it is a foundation for decentralized solutions to thrive. The earliest days of Bitcoin saw the creation of different types of decentralized applications using primitive Web3 contracts: NFTs started on Bitcoin (remember Counterparty?), as did programmable transactions (Mastercoin). Colored Coins, another early Bitcoin project, pioneered the idea of the tokenization of different real-world assets.

Type
Deep dive
Topic(s)
Ecosystem
Bitcoin
Published
August 8, 2022
Author(s)
Community Manager
Web3 Contracts on Bitcoin
Contents

Web3 contracts for Bitcoin aren’t a theoretical concept. They’ve been around for years, and now, thanks to a number of projects enabling developers to build on Bitcoin, including Stacks (a programming layer for Bitcoin), Web3 contracts for Bitcoin are more versatile than ever before. Let’s take a look at how developers use Bitcoin Web3 contracts to build different types of decentralized applications for the benefit of the Bitcoin ecosystem.

Enabling Versatile Bitcoin Web3 Contracts

When you think about smart contracts, your initial thoughts will most likely go to Ethereum or one of the new EVM-compatible chains. If you aren’t conversant with the Bitcoin ecosystem, you may not know that there are Bitcoin smart contracts at all.

This knowledge gap is understandable because Bitcoin itself has a scripting language that is intentionally designed to limit its expressiveness in order to reduce the potential surface area of attack vectors. Developers interested in creating apps in the Bitcoin ecosystem were limited in how they could bring their ideas to life using Bitcoin Script.

However, today Bitcoin smart contracts are part of the mainstream conversation on Web3 app development, all thanks to Stacks, a programming layer for Bitcoin, and the Clarity programming language, which enables developers to write Web3 smart contracts for Bitcoin. Through Clarity, developers can write fully expressive smart contracts to build dApps on par with what’s obtainable on other smart contracts platforms.

Smart contracts are the building blocks of decentralized applications. Bitcoin smart contracts, like smart contracts on any blockchain, are self-executing computer programs designed to carry out specific actions when certain predefined events occur.

What separates Bitcoin smart contracts from other types of smart contracts is that Bitcoin smart contract transactions settle on the Bitcoin network and have read access to Bitcoin’s global state. To learn more about Bitcoin smart contracts, check out one of our earlier posts on how Bitcoin smart contracts work, and watch this overview of how to deploy Bitcoin smart contracts:

Ready to meet some Bitcoin builders?

Bitcoin Web3 Contracts for DeFi: ALEX

ALEX is a next-generation DeFi platform built for the Bitcoin ecosystem using Clarity smart contracts on Stacks. ALEX is a play on Automated Liquidity EXchange; it models how Bitcoin Web3 contracts can be used to build sophisticated DeFi solutions, including lending, staking, farming, and liquidity pools.

Activating the Bitcoin DeFi Ecosystem Through Stacks

ALEX provides a simple but powerful value proposition — to build a financial infrastructure for Bitcoin through Stacks. ALEX does this through an Automated Market Maker (AMM) that leverages algorithms for price discovery and smart contracts to execute trades. ALEX also facilitates the swapping, staking, liquidity mining, farming, and lending of assets within the Stacks ecosystem.

ALEX is building out a full suite of DeFi primitives for developers and users in the Bitcoin ecosystem. The team behind ALEX chose to build the protocol atop the Bitcoin network becauseStacks makes Bitcoin programmable, enabling decentralized apps and smart contracts that inherit all of Bitcoin’s powers. Back-of-envelope calculation tells us that the DeFi market on Bitcoin could be as big as $300bn. ALEX will be part of it.”

Bitcoin DeFi with Web3 Contracts

More than $5 billion dollars worth of Bitcoin is currently locked in Wrapped BTC (WBTC) on Ethereum, and there is clear demand to make Bitcoin a productive asset in DeFi applications. Bitcoin DeFi enabled by projects like ALEX makes that process easier, and simultaneously benefits from the increased security of having transactions settle on the Bitcoin chain itself.

By using Bitcoin Web3 contracts, projects like ALEX enable near-native use of Bitcoin in DeFi use cases because Stacks can read Bitcoin’s blockchain state, unlike Ethereum and other chains.

Words of Advice for Other Bitcoin Developers 

We asked the ALEX team if they had any tips or advice for developers interested in building on Stacks. The ALEX team said, “Stacks is decentralized; finding resources can be challenging. Utilizing the fantastic Stacks community via social is effective.”

Bitcoin Web3 Contracts for Social Impact: CityPacks

CityPacks is leveraging NFTs as a tool for driving long-lasting and sustainable social good across communities in the United States. CityPack extends the functionalities of NFTs into new use cases for funding educational programs to empower students in public schools. The platform also leverages DeFi to promote sustainable charity funding through the use of yield-generating products. 

Funding Educational Programs With Bitcoin NFTs

CityPacks NFT Collection 001 is already being used to fund Miami-Dade County public school programs. CityPacks unlocks a new range of utilities for NFTs by applying them toward education for social impact. To reach this goal, CityPacks applies 75% of primary sales and an additional 4% of lifetime royalties from the resale of the NFTs to fund educational programs through the Foundation for New Education Initiatives (FNEI). The predefined percentage of revenue and ongoing royalties is baked into each NFT collection using Bitcoin Web3 contracts on Stacks.

Creating Complex Systems and Processes With Bitcoin Smart Contracts

CityPacks’ roadmap includes plans to create a Decentralized Autonomous Organization (DAO) that will enable decentralized community engagement and treasury management. This DAO component will be powered by StackerDAO Labs, another Stacks entity. CityPacks also plans to do more with Bitcoin smart contracts than minting NFTs and running DAOs; its roadmap includes a plan to create a “learn-to-earn” platform as well as launch yield-generating products to provide sustainable funding for social impact organizations.

The CityPacks team noted that they chose to build the project on Stacks because it presented the opportunity to “harness the power of incredible smart community builders and members, low gas fees, and contribute to an ecosystem that allows us to leverage open DeFi protocol, NFTs, dApps, and smart contracts built for Bitcoin.

The team also highlighted Clarity’s predictability as a reason to build for Bitcoin. Clarity is a decidable language in that developers can know exactly how a smart contract code will run or where it will terminate even before executing the code. This decidability helps make Web3 contracts easier to reason with, which is helpful in the testing and debugging process.

Words of Advice for Other Bitcoin Developers

We asked the CityPacks team if they had any tips or advice for developers interested in building on Stacks. In their words: “Don't be shy, reach out, build real connections, help out, be supportive, and don't be afraid to build on the most battle-tested and valuable blockchain in the world.”

Bitcoin Web3 Contracts for NFTs: Gamma

Gamma is an open marketplace on a mission to become the one-stop shop to mint, create, and collect Bitcoin NFTs. Gamma applies Web3 contracts to make NFTs more accessible through a user-first marketplace, creator-first launchpad, and a social platform to bring creators and collectors together. Some of the popular NFT collections listed on Gamma include Megapont Ape Club, Bitcoin Monkeys, and Crash Punks.

Unlocking Creator Tools for NFTs With Bitcoin

Gamma aims to become the leading marketplace for NFT enthusiasts within the Bitcoin ecosystem. Beyond being a simple marketplace for NFTs, Gamma goes a step further to provide free creator tools to help artists mint their own NFTs. Gamma is also working on using Web3 contracts to power native Bitcoin payments as well as drive auctions and private sales.

Learn more about how Gamma built their create portal on the Hiro blog.

Tapping Into the Pent-Up Demand in the Bitcoin Community

The team behind Gamma revealed that they chose to build the project on Stacks because they are “strong believers in the security and fundamental values of Bitcoin,” and Stacks provides the perfect platform to build for the Bitcoin community. They also mentioned they believe that Bitcoin provides the most “secure settlement layer for realizing the potential for NFTs.”

In terms of the developer experience, while building for the Bitcoin community, Gamma observes that “We found the community and Hiro very supportive of everything we did and found guidance and help from several people.” They also highlighted how the “Hiro team implemented the features and API changes we requested to make the developer experience easier.” We’re happy we could help!

Words of Advice for Other Bitcoin Developers

Here’s a word of encouragement from Gamma to other developers interested in exploring the Bitcoin ecosystem. “Start building! You’ll find people appreciative of the work you do and lots of help and guidance along the way.”

Start Building dApps with Bitcoin Web3 Contracts

Bitcoin had a scripting language that was intentionally optimized for security at the expense of programmability. Developers still managed to build apps like Colored Coins and Counterparty with that limited scripting language. However, those limitations ultimately handicapped the functionality of apps built with it, and it wasn’t long before dApps built on other chains took all the momentum.

Now, Stacks functions as a programming layer for writing fully expressive smart contracts to unlock new functionalities that didn’t exist before in Bitcoin smart contracts. Bitcoin Web3 contracts have been reengineered to empower developers to build a wide range of decentralized applications all on top of the oldest and most secure blockchain

We’ve shown you some of the apps built with Bitcoin smart contracts, and there’s a long list of other live apps — and an even longer list of projects being developed. At Hiro, we actively build developer tools and resources to empower you to build Web3 applications for the Bitcoin ecosystem.

Ready to kickstart your development journey into Web3? Download our free guide to developing smart contracts to get started.

Product updates & dev resources straight to your inbox
Your Email is in an invalid format
Checkbox is required.
Thanks for
subscribing.
Oops! Something went wrong while submitting the form.
Download Guide
Copy link
Mailbox
Hiro news & product updates straight to your inbox
Only relevant communications. We promise we won’t spam.

Related stories