On-chain habit tracking with accountability on Stacks
- What is AhhbitTracker?
- How It Works
- Tech Stack
- Getting Started
- Deploy to Vercel
- Contract Reference
- Security
- Documentation
- Contributing
- License
AhhbitTracker is a decentralized habit-tracking dApp on the Stacks blockchain. Stake STX as a financial commitment to daily habits. Miss a day — your stake is forfeited to a shared pool. Complete a 7-day streak — reclaim your stake and earn bonuses from forfeited stakes.
Live contract: SP1N3809W9CBWWX04KN3TCQHP8A9GN520BD4JMP8Z.habit-tracker-v2
- Stake — Create a habit and deposit ≥ 0.02 STX as your commitment
- Check In — Record daily completion within the 24-hour window (~144 blocks)
- Streak — Maintain a 7-day streak to unlock withdrawal
- Withdraw — Reclaim your stake and claim your share of the bonus pool
Missed check-ins forfeit your stake to the shared pool, distributed as rewards to users who complete their streaks.
| Layer | Technology |
|---|---|
| Smart Contract | Clarity 2.0 on Stacks Mainnet |
| Frontend | React 18 · TypeScript · Vite 5 · Tailwind CSS |
| State | @tanstack/react-query |
| Wallet | @stacks/connect (Leather · Xverse · Asigna) |
| Testing | Vitest + Clarinet SDK |
| Deployment | Vercel |
Prerequisites: Node.js ≥ 18, Clarinet CLI
git clone https://github.com/Yusufolosun/AhhbitTracker.git
cd AhhbitTracker
npm install
cd frontend
cp .env.example .env.local
npm install
npm run dev # → http://localhost:3000npm test # Run contract + stx-utils tests (111 tests)
cd frontend && npm test # Run frontend tests (30 tests)
clarinet check # Validate Clarity syntax| Package | Description |
|---|---|
stx-utils |
Zero-dependency utility library for Stacks — formatting, validation, block math, address helpers |
ahhbit-tracker-sdk |
Typed SDK for the AhhbitTracker contract — transaction builders, read-only queries, post-conditions |
cd frontend
npm run build # → frontend/dist/
npm run preview # Preview locally- Import the repository in Vercel
- Set Root Directory →
frontend - Build settings are auto-detected from
vercel.json - Optionally override
VITE_CONTRACT_ADDRESS/VITE_CONTRACT_NAME
| Function | Description |
|---|---|
create-habit |
Create a habit with STX stake |
check-in |
Record daily check-in |
withdraw-stake |
Reclaim stake after 7-day streak |
claim-bonus |
Claim share of forfeited pool |
get-habit |
Read habit details |
get-pool-balance |
View total forfeited STX |
Full reference → docs/API_REFERENCE.md
- Post-condition validation on every STX transfer
- On-chain authorization — only habit owners can check in, withdraw, or claim
- Input validation enforced in the smart contract
- No private keys, mnemonics, or secrets in this repository
See docs/SECURITY.md for the full security model.
| Document | Description |
|---|---|
| User Guide | End-user walkthrough |
| API Reference | Contract functions and error codes |
| Architecture | System design and data flow |
| FAQ | Common questions |
| Security | Security model |
Pull requests are welcome. See CONTRIBUTING.md.