LockD
LockD: The Web3 accountability protocol. Stake crypto as a hostage for your goals. Miss a deadline? Assets freeze. Turn loss aversion into pure productivity.
视频
技术栈
描述
LockD: Decentralized Commitment Protocol
💡 Inspiration
We all have goals—learning a new language, coding everyday, or hitting the gym. But we often fail because rely on willpower, which is a finite resource. Current productivity apps rely on positive reinforcement (badges, streaks), but behavioral psychology tells us that Loss Aversion (the fear of losing something) is a motivator 2x stronger than the desire to gain.
I built LockD to solve my own procrastination. I wanted a system that doesn't just "track" my habits, but actively enforces them with real financial consequences.
🤖 What it does
LockD is a Web3 accountability tool where users stake crypto assets (ETH/USDC) as a "hostage" for their commitment.
The Pledge: Users lock funds into a Smart Contract for a set duration (1, 3, or 7 days).
The Grind: Users must "Check-In" daily via the dApp to prove they are actively working on their goal.
The Twist (Sudden Death): If a user misses a 24-hour window, the Smart Contract passively detects the delay and flips the pledge status to FROZEN.
The Redemption: Frozen assets aren't lost immediately. Users can trigger a "Redemption Mission" (a strict 3-day streak). If successful, they recover 80% of their funds (20% is the penalty). If they fail again, the assets are liquidated 100%.
⚙️ How we built it
LockD is a fully decentralized application (dApp) built with a "Trustless" architecture in mind.
Smart Contract: Written in Solidity. I implemented a custom State Machine (
Active->Frozen->Redeeming->Claimed) to handle the complex logic of failure and redemption.Optimization: I used Variable Packing in the
structdesign to fit 8 different variables (including address, timestamps, and enums) into just 2 storage slots. This ensures the protocol is extremely gas-efficient for users.Frontend: Built with React and Vite for a fast, responsive experience. The UI uses a "Dark Mode" aesthetic with aggressive visual cues (Red/Hazard stripes) to trigger the user's sense of urgency when their assets are frozen.
Security: Implemented
ReentrancyGuardand strictmodifierchecks to prevent exploitation during the withdrawal process.
🧠 Challenges I ran into
The biggest challenge was handling Time Management On-Chain. Blockchains don't have a native cron job or alarm clock.
Problem: How do we "freeze" a user's funds if they simply stop interacting with the contract?
Solution: I implemented a "Passive Check" logic. The contract validates the time difference (
block.timestampvslastCheckIn) every time the user attempts an interaction. If the gap exceeds the grace period, the transaction executes but forces a state change toFROZENinstead of a successful check-in.
🚀 What's next for LockD
Social Verification: Allowing friends to "vouch" for a user's progress.
NFT Badges: Minting dynamic NFTs that evolve based on the user's consistency streak.
Multi-Chain Support: Deploying to low-cost L2 networks (Base, Optimism) to make it accessible for micro-commitments ($1-$5).