| name | stacks-blockchain-development |
| description | Builds full-stack decentralized applications on Stacks L2 for Bitcoin. Use when developing dApps, integrating sBTC, connecting wallets (Leather, Xverse), deploying smart contracts, building with Clarity, or interacting with Stacks APIs. Don't use for Ethereum, Solana, or non-Bitcoin layer 2 development. |
Stacks Blockchain Development
Procedures
Step 1: Getting Started
- Verify Clarinet is installed:
clarinet --version
- Install VS Code extension "Clarity - Stacks Labs"
- Install Leather wallet and switch to Testnet
- Read
references/getting-started.md for detailed setup instructions
- For Clarity smart contract development, use the
clarity-lang skill
Step 2: Project Setup
- Create new project:
clarinet new <project-name>
- Generate contract:
clarinet contract new <contract-name>
- Understand networks: simnet (local), devnet (Docker), testnet, mainnet
- Read
references/networks.md for network configuration
Step 3: Frontend Development with Stacks.js
- Install Stacks.js packages:
@stacks/connect - Wallet connections
@stacks/transactions - Transaction building
@stacks/network - Network configuration
- Read
references/stacks-js.md for:
- Wallet authentication (connect/disconnect)
- Transaction construction and signing
- Calling public and read-only contract functions
- Post-condition implementation
Step 4: Wallet Integration
- Read
references/wallets.md for wallet-specific integration:
- Leather (recommended)
- Xverse
- Wallet selector modal configuration
- Implement wallet connection in frontend
- Handle authentication callbacks
Step 5: sBTC Integration
- Read
references/sbtc.md for:
- sBTC contract addresses (mainnet/testnet)
- Transferring sBTC in contracts
- Use sBTC for payments in smart contracts
- Read
references/post-conditions.md for asset protection
Step 5a: sBTC Bridging (BTC ↔ sBTC)
- Read
references/bridging.md for:
- Deposit flow (BTC → sBTC)
- Withdraw flow (sBTC → BTC)
- sBTC library usage
- Use
sbtc npm package for integration
- Handle signer operations and confirmations
Step 5b: Token Swaps and DEX
- Read
references/swaps.md for:
- Alex DEX integration
- Token swap API
- Liquidity pools (add/remove)
- Implement swap functionality in dApp
- Handle price quotes and slippage
Step 6: Token Standards
- Read
references/tokens.md for:
- SIP009 NFT implementation
- SIP010 fungible token implementation
- Deploy standard-compliant tokens
- Integrate with marketplaces
Step 7: Stacking (STX Rewards)
- Read
references/stacking.md for:
- Stacking delegation
- Pool operators
- Reward cycle management
- Implement stacking in dApps
Step 8: BNS (Bitcoin Name Service)
- Read
references/bns.md for:
- Name registration
- Name resolution
- BNSv2 integration
Step 9: Testing
- Run
clarinet check for contract analysis
- Run
clarinet test for unit tests
- Use simnet for fast iteration
- Use devnet for integration testing with Bitcoin
- Read
references/clarinet.md for testing patterns
Step 10: Deployment
- Configure deployment in
settings/Testnet.toml or settings/Mainnet.toml
- Generate deployment plan:
clarinet deployments generate --testnet
- Apply deployment:
clarinet deployments apply --testnet
- Read
references/deployment.md for detailed instructions
Step 11: APIs and Data Fetching
- Read
references/apis.md for:
- Hiro Platform API
- Stacks RPC endpoints
- Fetching blockchain data
- Getting block info, transactions, contract data
Step 12: Chainhooks (Event Indexing)
- Read
references/chainhooks.md for:
- Setting up chainhook predicates
- Indexing contract events
- Webhook configuration
Step 13: Oracles and Price Feeds
- Read
references/oracles.md for:
- Integrating price oracles
- Fetching off-chain data
Step 14: Security and Monitoring
- Read
references/security.md for:
- Smart contract auditing
- Common vulnerabilities
- Best practices
- Read
references/monitoring.md for:
- Contract alerts
- Transaction monitoring
Step 15: Explorer Usage
- Read
references/explorer.md for:
- Searching transactions
- Viewing contracts
- Using Sandbox for contract interaction
Error Handling
- If Clarinet not found, install from https://github.com/stx-labs/clarinet
- If wallet connection fails, verify wallet is installed and on correct network (testnet/mainnet)
- If contract deployment fails, check deployment fees and account balance
- If transaction rejected, verify post-conditions and network selection
- If API calls fail, check Hiro API key and rate limits
Resources