Automated STX stacking optimizer for maximum Bitcoin yield on Stacks
bitstake is an automated yield optimization protocol for STX holders on the Stacks blockchain. By participating in Stacks' Proof-of-Transfer (PoX) mechanism, STX holders earn native Bitcoin rewards. bitstake automates the entire process — pool management, cycle timing, reward distribution, and compounding — so you earn more BTC with zero manual effort.
Stack smarter. Earn Bitcoin. Stay in control.
- Auto-Stacking — automatically re-stacks your STX each cycle without manual intervention
- Pool Aggregation — pools small STX holders together to meet the dynamic stacking minimum
- Reward Distribution — distributes earned BTC proportionally to all pool participants
- Yield Analytics — real-time APY tracking and historical reward dashboard
- Flexible Lockup — choose 1–12 cycle lockup periods to match your liquidity needs
- Liquid Stacking Token — receive
bSTX(liquid staking token) redeemable 1:1 for STX after unlock - Emergency Unstacking — exit queue mechanism for early unstacking requests
- Non-Custodial — you hold your keys; bitstake never takes custody of your STX
STX Holder → Locks STX for N cycles → Bitcoin address registered
Miners pay BTC to stack participants → BTC distributed pro-rata
Cycle ends → STX unlocked → repeat
Each Stacks cycle is ~2 weeks. bitstake handles the timing, registration, and BTC claims automatically.
| Layer | Technology |
|---|---|
| Smart Contracts | Clarity (Stacks) |
| Stacking Protocol | Stacks PoX-4 |
| Frontend | Next.js 14 + TypeScript |
| Blockchain SDK | Stacks.js |
| BTC Distribution | Bitcoin script + Clarity |
| Price Oracle | Pyth Network on Stacks |
| Testing | Clarinet + Vitest |
| Indexing | Hiro API + custom indexer |
bitstake/
├── contracts/
│ ├── bitstake-pool.clar # Core pool and stacking logic
│ ├── bitstake-token.clar # bSTX liquid staking token (SIP-010)
│ ├── bitstake-rewards.clar # BTC reward distribution
│ ├── bitstake-oracle.clar # Price feed integration
│ └── traits/
│ ├── pool-trait.clar
│ └── reward-trait.clar
├── frontend/
│ ├── app/
│ │ ├── dashboard/
│ │ ├── stake/
│ │ └── rewards/
│ └── components/
├── indexer/
│ ├── cycle-watcher.ts
│ └── reward-claimer.ts
├── tests/
│ ├── pool.test.ts
│ └── rewards.test.ts
└── scripts/
├── register-pool.ts
└── claim-rewards.ts
(contract-call? .bitstake-pool deposit u10000000000)
;; Returns bSTX tokens at 1:1 ratio(contract-call? .bitstake-pool withdraw u10000000000)
;; Burns bSTX, returns STX + accumulated rewards(contract-call? .bitstake-rewards claim-btc-rewards)
;; Sends earned BTC to your registered Bitcoin address(contract-call? .bitstake-pool set-btc-address 0x...)
;; Register the BTC address where your rewards will be sent(contract-call? .bitstake-pool get-pool-stats)
;; Returns: total-stacked, current-apy, cycle-end-block, reward-pool-btc- Node.js >= 18
- Clarinet >= 2.0
- A Stacks wallet with STX balance
- A Bitcoin address for receiving rewards
git clone https://github.com/thewealthyplace/bitstake
cd bitstake
npm install# Start local Stacks devnet (includes simulated PoX)
clarinet devnet start
# Run tests
clarinet test
# Start frontend
cd frontend && npm run dev- Visit the bitstake app and connect your Hiro or Leather wallet
- Enter the amount of STX you want to stack
- Choose your lockup period (1–12 cycles)
- Register your Bitcoin address for rewards
- Confirm the transaction — bitstake handles everything else
| Lockup Cycles | Approx. Duration | Estimated APY* |
|---|---|---|
| 1 | ~2 weeks | Variable |
| 3 | ~6 weeks | Variable |
| 6 | ~3 months | Variable |
| 12 | ~6 months | Variable |
*APY depends on total STX stacked network-wide and Bitcoin miner fees. Historical data available in the dashboard.
When you deposit STX, you receive bSTX — a SIP-010 compliant liquid staking token:
- Redeemable 1:1 for STX after your lockup period
- Can be transferred, traded, or used as collateral in DeFi
- Accrues BTC yield that is claimable separately
- Maintains full transparency via on-chain accounting
| Fee | Rate | Recipient |
|---|---|---|
| Pool management fee | 0.5% of BTC rewards | Protocol treasury |
| Early exit fee | 2% of STX | Redistributed to remaining stakers |
| Deposit/withdrawal | 0% | — |
- Non-custodial: users control their STX via smart contracts only
- Audited Clarity contracts with formal verification planned
- Multi-sig admin keys for protocol parameter updates
- Emergency pause mechanism controlled by governance
- Comprehensive Clarinet test suite
bSTX tokens are designed to be used as collateral in Stacks DeFi protocols while continuing to earn BTC stacking yield.
| Protocol | Integration | Status |
|---|---|---|
| ALEX | Lending collateral | Proposed |
| Bitflow | bSTX/STX LP pair | Deployed |
| Velar | Synthetic collateral | Planned |
The bitstake-bstx-oracle contract provides an on-chain exchange rate:
;; Returns bSTX/STX rate at 6 decimal precision
;; e.g. 1_050_000 = 1.05 STX per bSTX
(contract-call? .bitstake-bstx-oracle get-spot-rate)Rate manipulation is mitigated by:
- TWAP accumulator — block-time-weighted 20-checkpoint window
- Circuit breaker — trips on >5% single-observation or >10% rolling deviation
;; Add liquidity to bSTX/STX concentrated pool (0.95–1.05 range, 0.05% fee)
(contract-call? .bitstake-bitflow-pool add-liquidity bstx-amount stx-amount min-bstx min-stx)
;; Swap STX for bSTX
(contract-call? .bitstake-bitflow-pool swap-stx-for-bstx stx-in min-bstx-out)See docs/bstx-defi-collateral.md for the full integration guide.
- Core pool stacking contracts
- bSTX liquid token
- BTC reward distribution
- Frontend dashboard with live APY, cycle countdown, and historical charts
- 52-cycle APY chart and cycle calendar with unlock highlights
- Wallet earnings view with CSV export
- Live SSE block feed (no page reload)
- Multi-pool strategy (conservative / aggressive)
- ALEX lending collateral (pending governance vote)
- Mobile app
- Governance token for protocol decisions
git clone https://github.com/thewealthyplace/bitstake
cd bitstake
npm install
clarinet check
clarinet testMIT © thewealthyplace