Time Capsule is a decentralized application (dApp) on the Solana blockchain that allows users to create digital time capsules. These capsules can hold messages, promises, or predictions, locked until a specific future date. Upon unlocking, a community voting mechanism determines the resolution of the capsule, which can trigger the release of staked funds to specific destinations.
Built with Rust and the Anchor Framework, the smart contract provides the core logic for the Time Capsule protocol:
- Create Capsules: Users can initialize capsules with:
- Metadata URI (stored off-chain, e.g., IPFS/Pinata).
- Unlock timestamp.
- Voting duration and quorum requirements.
- Custom token details (Name/Symbol).
- Staking Mechanism: Users can attach SOL stakes to capsules with programmable destinations:
- Return to Creator.
- Burn (send to a burn address).
- Send to a specific 3rd party address.
- Community Governance:
- Open for Voting: Once the time lock expires, the capsule enters a voting period.
- Cast Vote: Community members vote on the validity or outcome of the capsule.
- Resolve: The capsule is finalized based on the vote outcome (Pass/Fail).
- Claim & Management:
- Claim: Staked funds are distributed according to the resolution logic.
- Cancel: Creators can cancel a capsule before the lock period begins.
- Close: Clean up accounts and reclaim rent after resolution.
A modern, responsive web interface built with Next.js 16 and React 19:
- Interactive UI:
- Parallax Landing Page: Engaging entry point with
framer-motionanimations. - Creation Wizard: Step-by-step process to deploy new capsules effortlessly.
- Dashboard: View capsule status, countdown timers, and voting progress.
- Parallax Landing Page: Engaging entry point with
- Wallet Integration: Seamless connection with Solana wallets (Phantom, Solflare, etc.) using
@solana/wallet-adapter. - Real-time Updates: Live countdowns and state updates for capsule lifecycles.
- Modern Tech Stack:
- Styling: Tailwind CSS v4, Radix UI primitives for accessible components.
- Animations: Smooth transitions and complex animations using Framer Motion.
- Notifications: Toast notifications via
sonner.
.
βββ Anchor.toml # Anchor configuration
βββ programs/ # Solana Smart Contract (Rust)
β βββ time-capsule/
β βββ src/
β β βββ instructions/ # Program instructions (Create, Vote, Claim, etc.)
β β βββ state.rs # Account data structures
β β βββ lib.rs # Program entry point
βββ app/ # Frontend Application (Next.js)
β βββ app/ # Next.js App Router pages
β β βββ create/ # Capsule creation flow
β β βββ capsules/ # Capsule details and interaction pages
β β βββ components/ # Shared UI components
β βββ lib/ # Utilities and Solana integration
β βββ public/ # Static assets
βββ tests/ # Integration tests (TypeScript)
- Node.js (v18+ recommended)
- Rust & Cargo
- Solana CLI
- Anchor CLI
-
Install Dependencies:
yarn install
-
Build the Program:
anchor build
-
Test the Program: Start a local validator and run tests:
anchor test
-
Navigate to the App Directory:
cd app -
Install Dependencies:
npm install # or yarn install -
Run Development Server:
npm run dev
-
Open in Browser: Visit
http://localhost:3000to see the application.
The program ID is defined in lib.rs: BWRB15yyv6d6sbv9sq3GZxs1ptvE49QfZhzVx4n4UycJ
Key instructions:
initialize_capsuleadd_stakeopen_for_votingcast_voteresolve_capsuleclaimcancel_capsuleclose_capsule
- Blockchain: Solana, Anchor
- Frontend: Next.js, React, TypeScript, Tailwind CSS
- Libraries: Framer Motion, Lucide React, Solana Web3.js