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.
Videos
Description
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).
Progress During Hackathon
Day 1: Ideation & Logic Architecture Conceptualized the "Hostage Stake" mechanism based on Loss Aversion psychology. Designed the core State Machine flow (Active -> Frozen -> Redeeming). Pivot: Decided to remove IPFS/Photo proof verification to focus purely on on-chain time validation for a stronger, trustless MVP. Day 2: Smart Contract Development Wrote the LockD.sol contract from scratch. Implemented "Struct Packing" to optimize storage from 6 slots down to 2 slots (Gas efficiency). Solved the "Cron Job" problem by implementing a passive check logic (block.timestamp validation) inside the checkIn function. Day 3: Frontend Integration & UI Polish Built the frontend using React & Vite. Integrated Wallet connection (Wagmi/Viem). Designed the "Hazard/Warning" UI state to visually trigger urgency when a user's funds are frozen. Connected the frontend to the Smart Contract functions (createPledge, checkIn, startRedemption). Day 4: Testing & Deployment Deployed the contract to [Arbitrum Sepolia] testnet. Conducted rigorous testing on the "Sudden Death" logic to ensure the freeze mechanism triggers correctly after the grace period. Recorded the demo video.