Skip to content

Latest commit

 

History

History
44 lines (29 loc) · 4.67 KB

README.md

File metadata and controls

44 lines (29 loc) · 4.67 KB

Welcome to Clarity Examples

The Clarity Examples repository includes a collection of reusable Clarity smart contracts. These examples can help developers rapidly kickstart their journey onto the Stacks blockchain.

Furthermore, Hiro Platform allows developers to discover these smart contracts, clone, extend, and deploy the customized contracts—in a few clicks—all from the browser.

NOTE: The examples provided in this repository are for educational purposes and have not been security audited.

Available Examples

Clarity Example Description
hello-world A beginner smart contract with examples of read-only and public functions
blank-project Create a project from scratch: Start from a blank scaffold for your next Clarity contract
stx-defi Demonstrates a DeFi protocol with deposits of STX, borrowing and repaying the STX-based loan, and interest and yield calculations
counter Demonstrates how to use and interact with "variables" in Clarity by incrementing a 32-bit unsigned integer
clarity-bitcoin Demonstrates how to parse Bitcoin transactions and block headers, and to verify Bitcoin transactions
fungible-token Demonstrates a basic fungible token that conforms to the SIP-010 FT standard
non-fungible-token Demonstrates a basic NFT collection that conforms to the SIP-009 NFT standard
nft-marketplace Demonstrates a minimalistic NFT marketplace that allows users to list NFT for sale
lightning-swaps Demonstrates LNSwap's submarine swaps between Stacks and Bitcoin
ordyswap Demonstrates trustless atomic swaps between Ordinals and Stacks
btc-tx-enabled-nft A Clarity smart contract that allows you to mint an NFT based on a bitcoin transaction
semi-fungible-token A concept semi-fungible token standard and reference implementation for the Stacks blockchain based on SIP13

Logistics

All examples include a README and some have pointers to real-world projects in the Stacks blockchain.

Each example also includes unit tests under the /tests directory to help guide developers to familiarize themselves with testing concepts.

Additionally, each example can run in Clarinet as-is. In a terminal of choice and with Clarinet installed, developers can go to the respective example folder, run clarinet check, clarinet integrate, and explore other Clarinet features.

Alternatively, you can skip setting up your development environment on your laptop and instead go to https://platform.hiro.so to let Hiro Platform do all the heavy lifting of setting it up on your behalf. You can select the example of choice, explore the code, customize it, or deploy it to Stacks blockchain in a few clicks.

With Hiro Platform, we want to encourage developers to focus on shipping their business models to Stacks blockchain, ship often and happily, and not get caught up with unboxing and infrastructure overhead.

Contributing

Contributions are welcome!

To prepare the project for development, run npm i from the root of your local clone/fork.

This project contains a pre-commit script that will generate a new metadata.json file and new contents of the zips folder based on your changes. This script will run automatically pre-commit, or you can run it manually using the command npm run build.