Welcome. This is EasyA's legendary handbook. If you want to learn Stacks like a legend, then you're in the right place.
This handbook serves as a guide to the Stacks ecosystem, geared towards those just joining for the first time. It isn't just a beginners' handbook; it's a legendary handbook. Even if you've already immersed yourself in the ecosystem, you'll find tons of helpful tidbits around here!
Of course, the best place to start is always the EasyA app! Download it here for the fastest and most fun way to learn about Stacks. Download it directly right here!
- Introduction
- Getting Started
- Core Concepts
- Development Tools
- Smart Contracts
- Stacks Blockchain
- Ecosystem Projects
- Resources
- Handy Code Snippets
- Contributing
What is Stacks:
- Stacks Overview - Fundamentals of Stacks and its integration with Bitcoin.
The no-fluff starter:
- Official Stacks documentation - Comprehensive guides and references for Stacks development.
- Hiro documentation - In-depth resources for building on Stacks with Hiro tools.
- Stacks 101 - Community-driven knowledge hub for learning Stacks.
Explanation of fundamental concepts in the Stacks ecosystem:
- Clarity Language - Learn about the smart contract language designed for Stacks.
- Proof of Transfer (PoX) consensus mechanism - Understand the unique consensus mechanism that connects Stacks to Bitcoin.
Key tools and environments for Stacks:
- Clarinet - CLI tool for developing and testing Clarity smart contracts.
- Hiro Platform - Browser-based IDE for streamlined Clarity development.
- Stacks.js - Powerful JavaScript libraries for interacting with the Stacks blockchain.
How to write and deploy smart contracts on Stacks:
- Example Contracts - Repository of Clarity smart contract examples for learning and reference.
- Audited Example Smart Contracts - Curated collection of security-audited Clarity contracts.
- NFT Tutorial - Hands-on guide to creating NFTs with Clarity.
Going into the blockchain level:
- Stacks API - Comprehensive API for interacting with the Stacks blockchain and retrieving data.
- Hiro Explorer - User-friendly interface for browsing Stacks blockchain data.
- STX Scan - Feature-rich explorer for Stacks transactions and blockchain information.
Cool projects built on Stacks:
- ALEX - Open-source DeFi protocol modeled on the world's financial markets.
- Arkadiko - Open source protocol that mints a stablecoin, generating Bitcoin yield.
- Bitflow - The decentralized exchange for Bitcoiners.
- Blocksurvey - AI-driven survey platform with focus on data ownership and privacy.
- btc.us - An application for .btc names.
- Console - Decentralized community application.
- Gamma - Explore, collect, and sell NFTs secured by Bitcoin.
- GoSats - Bitcoin Cashback Rewards application that enables stacking fractional bitcoin every time you shop.
- Hermetica - A Bitcoin-backed, yield-bearing synthetic dollar protocol.
- Light Finance - The only stablecoin with native yield for Bitcoin.
- MultiSafe - MultiSafe is a shared crypto vault for managing Stacks (STX) and Bitcoin (BTC).
- Owl Link - An application to create linking page for BNS names.
- Sigle - De-centralised and open-source Web 3.0 writing platform.
- Stacking DAO - Liquid stacking on Stacks.
- STX20 - The STX20 protocol introduces a novel approach to creating and sharing digital artifacts on the Stacks blockchain.
- Velar - Velar is a multi-feature DeFi app with Bitcoin finality, built on Stacks.
- Zest Protocol - Zest Protocol is a lending protocol, built for Bitcoin.
Extra stuff:
- Clarity Universe - Immersive learning experience for mastering Clarity development.
- Clarity of Mind Book - Comprehensive guide to writing efficient and secure Clarity smart contracts.
Some code snippets which you can copy/paste to kickstart your project:
;; Define a simple counter contract
;; Define a data var to store the counter
(define-data-var counter uint u0)
;; Public function to get the current count
(define-read-only (get-count)
(var-get counter))
;; Public function to increment the counter
(define-public (increment)
(begin
(var-set counter (+ (var-get counter) u1))
(ok (var-get counter))))
;; Public function to decrement the counter
(define-public (decrement)
(begin
(if (> (var-get counter) u0)
(var-set counter (- (var-get counter) u1))
(var-set counter u0))
(ok (var-get counter))))
import { StacksTestnet } from '@stacks/network';
import { callReadOnlyFunction, cvToValue, uintCV } from '@stacks/transactions';
// Set up the network (testnet in this example)
const network = new StacksTestnet();
// Define contract details
const contractAddress = 'ST2ZRX0K27GW0SP3GJCEMHD95TQGJMKB7G9Y0X1MH';
const contractName = 'counter';
const functionName = 'get-count';
// Call a read-only function
async function getCount() {
const result = await callReadOnlyFunction({
network,
contractAddress,
contractName,
functionName,
functionArgs: [],
senderAddress: contractAddress,
});
console.log('Current count:', cvToValue(result));
}
getCount();
These examples showcase:
- A simple Clarity smart contract for a counter.
- JavaScript code to interact with a Stacks smart contract.
We welcome contributions to make this handbook even more legendary! Here's how you can contribute:
- Fork the repository
- Create a new branch (
git checkout -b feature/amazing-addition
) - Make your changes
- Commit your changes (
git commit -am 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-addition
) - Create a new Pull Request
Please ensure your contributions align with our code of conduct and contribution guidelines.
This handbook was inspired by the famous awesome lists by sindresorhus. We need awesome lists for Web3 ecosystems, with more of a hacker's guide to how they work. This is the answer to that need.