Example Contracts
How Clarity contracts look in practice

This page collects example Clarity contracts that developers can use as practical starting points when building on Stacks.
You’ll find starter contracts that demonstrate common patterns and best practices in Clarity, as well as notable production contracts currently used by popular Stacks applications. Together, these examples are intended to help you understand how real-world contracts are structured, how different features are implemented, and how Clarity is used in practice.
Use these contracts as references, learning aids, or foundations to adapt and extend for your own applications.
Tokens
Example Templates
Fungible Token: A minimal SIP-010 fungible token contract implementation
Non-Fungible Token: A minimal SIP-009 non-fungible token contract implementation
Semi-Fungible Token: A minimal SIP-013 semi-fungible token contract implementation
Real Implementations
sBTC token: The SIP-010 fungible token implementation of BTC on Stacks.
USDCx token: The SIP-010 fungible token implementation for USDC on Stacks.
Megapont Ape Club NFT: A production-ready SIP-009 compliant NFT implementation featuring a 2,500-piece limited collection with built-in marketplace functionality.
AIBTCDEV Airdrop NFT: The NFT contract behind the largest airdrop in Bitcoin layers history, sending out nearly 800,000 NFTs.
DeFi
Example Templates
DeFi Lending: A DeFi lending protocol that allows users to deposit STX, borrow against their deposits, and earn yield from interest payments.
NFT Marketplace: A tiny NFT marketplace contract that enables users to list, buy, and sell NFTs with flexible payment options.
AMM DEX: A minimal, production-ready decentralized exchange (DEX) on Stacks (Bitcoin L2) implementing a constant-product AMM (x · y = k).
Real Implementations
StackingDAO Core: The main entry point contract for all StackingDAO user-related actions such as depositing and withdrawing STX, looking up the stSTX/STX ratio or a withdrawal NFT position of a user.
Bitflow Stableswap Core: An advanced swap contract of the Stableswap protocol.
STX.City's bonding curve DEX: An implementation of a simple bonding curve DEX, for deployed tokens, that facilitates the trading of tokens using a bonding curve mechanism.
Utilities
Example Templates
Smart Wallets: A smart contract wallet with specific rules, which is a sophisticated wallet abstraction that enables programmable spending rules and multi-admin governance.
Send Many: Enables efficient batch STX transfers to multiple recipients in a single transaction.
Counter: A simple on-chain counter that maintains individual count values for each principal address.
Multi-Sig Vault: A simple multisig vault that allows members to vote on who should receive the STX contents.
Timelocked Wallet: A time-locked vault contract that becomes eligible to claim by the beneficiary after a certain block-height has been reached.
Real Implementations
Bitflow's Keepers: A smart wallet implementation for Bitflow users that assists with complex automated DeFi strategies.
Pyth: A set of contracts that enables Pyth's price oracles on Stacks.
DIA: The DIA price oracle contract on Stacks.
Arkadiko Oracle: A community managed oracle contract by Arkadiko.
Cross-chain
Ordinals Swap: Enables trustless peer-to-peer atomic swaps between Bitcoin Ordinals and STX tokens.
Clarity Bitcoin Library: A stateless contract that enables you to verify that a transaction was mined in a certain Bitcoin block and parse a bitcoin transaction.
DAOs
Example Templates
ExecutorDAO Framework: ExecutorDAO is a modular, extensible DAO framework that uses a trait-based architecture to enable flexible governance structures.
On-Chain Voting: Decentralized on-chain voting for DAOs and communities on Stacks blockchain.
Crowdfunding: Create campaigns, raise STX, and build community-funded projects.
Other notable contracts on mainnet
Proof of Transfer (PoX): The core system contract that implements Stacks' consensus mechanism, enabling STX holders to lock their tokens and earn Bitcoin rewards.
SIP-019 Token Metadata Update: A helper contract that emits a SIP-019 print event notification for updating token metadata.
BNS v2: A decentralized naming system built on the Stacks blockchain. It allows users to register, manage, and transfer names within different namespaces.
Last updated
Was this helpful?