About the Project

SatsStaker is a non-custodial, smart contract-based protocol I built on the Stacks Layer 2 blockchain to enable secure Bitcoin yield generation. Users can stake sBTC, a wrapped, 1:1 Bitcoin-pegged token, and earn time-weighted rewards directly on-chain — all without giving up control of their assets.

Inspiration

The idea was born from a desire to unlock Bitcoin yield opportunities in a trust-minimized and transparent way. Most BTC yield products rely on centralized custody, so I set out to build a secure alternative where users remain in full control through Clarity smart contracts.

What I Learned

Through building SatsStaker, I gained valuable experience with:

  • Writing smart contracts in Clarity
  • Implementing non-custodial staking mechanisms
  • Calculating rewards using time × amount-based logic
  • Designing admin time-locks and safety checks for protocol updates
  • Managing on-chain state and ensuring gas efficiency

How I Built It

  • Language: Clarity
  • Stack: Stacks blockchain, sBTC (SIP-010 token standard), Clarinet, Stacks.js
  • Contract Address (Testnet): ST2VXPMB7WBJRS0HPJENJD7FR35907JV4X1E64DGN.sats-staker
  • Core Functions: stake(), unstake(), claim-rewards(), calculate-rewards()
  • I used Clarinet to write and test smart contracts, and designed the reward system to calculate yield per block using a basis point-based APY model.

Challenges Faced

Some key challenges included:

  • Ensuring accurate, fair reward accrual across varying stake durations
  • Designing robust error handling and time-based unstaking logic
  • Preventing potential attacks with reentrancy guards and underflow checks
  • Creating a secure yet flexible admin configuration system with time-lock controls

Security Features

  • Non-custodial design — funds are never accessible by the contract unless triggered by the user
  • Time-locks for all admin actions
  • Input validation for reward rate safety
  • Comprehensive state and access checks
  • Full audit planned before mainnet deployment

Built With

Share this project:

Updates