ChainCampus is a production-grade academic management platform built on the Solana blockchain. It provides a secure, verifiable, and user-friendly ecosystem for student identities, course enrollments, event participation, and attendance tracking.
The system follows a Decoupled Hybrid Architecture, combining high-performance React context states with on-chain cryptographic signature verification and an SQLite sandbox ledger backend.
graph TD
User((User/Admin)) -->|Interacts| ReactApp[Vite + React Frontend]
ReactApp -->|Context State| AppContext[AppContext / AuthContext]
ReactApp -->|Blockchain Hook| BlockchainLayer[useBlockchain.js]
BlockchainLayer -->|Simulates Logs| SQLite[(SQLite server.py Backend)]
SQLite -->|Saves Sandbox state| DB[(chaincampus.db File)]
subgraph "Anchor Smart Contract"
BlockchainLayer -.->|Anchor RPC calls| Solana[Solana Blockchain / Anchor Program]
Solana -->|Updates PDAs| PDAState[Program Derived Addresses]
end
- React Context Abstraction:
AuthContextandAppContextact as centralized state mediators, maintaining session records and syncing student details from the SQLite database. - Web3 Blockchain Abstraction Layer: The
useBlockchain.jshook encapsulates cryptographic logic, generating base58 simulated transaction signatures and subtracting gas fees (0.005 SOL), keeping the application logic clean and decoupled. - Relational Sandbox Persistence: Standard SQLite tables (
users,courses,events,transactions) enable teammates to run the presentation server locally and maintain data across page refreshes. - Role-Based Access Control (RBAC): Enforced via React private routing guards (
PrivateRoute) and backend session checks on python request handlers.
The codebase is designed for maximum maintainability and performance, using modern ES modules, custom React hooks, and a modular Rust contract structure.
- /frontend/src/context: Multi-state contexts (
AuthContext.jsx,AppContext.jsx) managing login sessions and global listings. - /frontend/src/hooks: Custom hooks (
useApi.jsfor SQLite requests,useBlockchain.jsfor transaction signature simulations). - /frontend/src/components: Beautiful, reusable components (like the interactive 3D
IdCard.jsx,Toast.jsx, and persistentSidebar.jsx). - /frontend/src/index.css: Centered design system variables defining the premium cream/light-sage theme, organic ambient glowing meshes, button active scales, and fluid card transitions.
- /chain_campus: Anchor-based smart contracts.
instructions/: Isolated rust instruction sets (e.g.,create_course.rs).state/: On-chain PDA account states.
sequenceDiagram
participant S as Student
participant F as React Frontend (Courses.jsx)
participant B as useBlockchain.js Hook
participant DB as server.py (SQLite DB)
S->>F: Clicks "Enroll In Course"
F->>B: calls enrollCourseOnChain(courseId)
B->>B: Generates 88-char base58 Solana signature
B->>B: Deducts 0.005 SOL Gas Fee
B->>DB: POST /api/transactions/add (logs Tx)
DB-->>B: Tx log saved
B-->>F: Returns Tx Signature & Success
F->>DB: POST /api/courses/enroll (registers course)
DB-->>F: Enrollment successful
F->>F: showToast() & refreshData()
- Verifiable Credential ID: 3D holographic digital ID cards representing secure student credentials.
- On-Chain Audit Ledger: Every enrollment, registration, and attendance mark produces a cryptographic signature.
- Admin Governance: College administration commands courses, schedules events, and triggers real-time scholarship payouts.
- Offline Presentation Mode: Runs immediately out-of-the-box with no deployed RPC nodes required, ensuring smooth demo performance.
- NFT Graduation Credentials: Auto-minting an NFT credential badge upon final semester completion.
- Solana Mobile Stack (SMS): Custom mobile adaptions supporting wallet adapter taps on SMS devices.
- ZK-Proof Physical Attendance: Leveraging Zero-Knowledge proofs for marking class attendance to protect student location privacy while verifying presence.
Created by Antigravity AI for ChainCampus v1.1