Skip to content

jobbykings/starked-education

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

274 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

StarkEd

StarkEd is a decentralized learning and credential verification platform powered by Stellar blockchain. It enables secure, tamper-proof issuance and verification of educational credentials, certificates, and achievements using Soroban smart contracts.

๐ŸŽฏ Features

  • ๐Ÿ“š Decentralized Learning - Course creation and management on blockchain
  • ๐ŸŽ“ Credential Verification - Tamper-proof certificates and achievements
  • ๐Ÿ”— Stellar Integration - Fast, low-cost transactions on Stellar
  • ๐Ÿ’ผ Professional Profiles - On-chain learning history and skills
  • ๐Ÿ† Achievement System - NFT-based badges and milestones
  • ๐Ÿ“Š Learning Analytics - Progress tracking and insights
  • ๐Ÿ” Secure Storage - IPFS integration for content persistence
  • ๐Ÿ”ฎ Holographic Storage - Advanced 3D data storage simulation
  • ๐ŸŒ Cross-Platform - Web and mobile applications

๐Ÿ› ๏ธ Technology Stack

Blockchain Layer

  • Stellar - Fast, scalable Layer 1 blockchain
  • Soroban - Smart contract platform for Stellar
  • Stellar SDK - JavaScript/TypeScript integration

Frontend

  • Next.js 14 - React framework with App Router
  • TypeScript - Type-safe development
  • TailwindCSS - Utility-first CSS framework
  • Stellar Wallets - Freighter, Albedo, and more
  • IPFS - Decentralized content storage

Backend

  • Node.js - Server-side JavaScript runtime
  • Express.js - Fast, minimalist web framework
  • PostgreSQL - Robust relational database
  • Redis - High-performance caching
  • Prisma - Modern database ORM
  • JWT - Secure authentication
  • IPFS HTTP Client - Decentralized storage integration

Smart Contracts

  • Rust - Memory-safe smart contract language
  • Soroban SDK - Stellar smart contract development
  • Cairo Compatibility - Cross-platform contract support

๐Ÿš€ Quick Start

Prerequisites

  • Node.js (v18+)
  • npm or yarn
  • PostgreSQL
  • Redis
  • Freighter or compatible Stellar wallet

Installation

# Clone the repository
git clone https://github.com/jobbykings/starked-education.git
cd starked-education

# Install dependencies
npm run install:all

# Set up environment
cp .env.example .env
# Edit .env with your configuration

# Start development
npm run dev

Development Setup

# Start Stellar network (local)
stellar standalone start

# Deploy contracts
cd contracts
npm run deploy:local

# Start backend
cd ../backend
npm run dev

# Start frontend
cd ../frontend
npm run dev

๐Ÿ“ Project Structure

starked-education/
โ”œโ”€โ”€ contracts/              # Soroban smart contracts (Rust)
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ lib.rs       # Main contract logic
โ”‚   โ”‚   โ””โ”€โ”€ test.rs      # Contract tests
โ”‚   โ””โ”€โ”€ Cargo.toml        # Rust dependencies
โ”œโ”€โ”€ frontend/               # Next.js React application
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ app/          # App Router pages
โ”‚   โ”‚   โ”œโ”€โ”€ components/    # Reusable UI components
โ”‚   โ”‚   โ””โ”€โ”€ lib/          # Utility functions
โ”‚   โ”œโ”€โ”€ public/             # Static assets
โ”‚   โ””โ”€โ”€ package.json        # Frontend dependencies
โ”œโ”€โ”€ backend/                # Node.js API server
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ routes/       # API endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ models/        # Database models
โ”‚   โ”‚   โ”œโ”€โ”€ middleware/    # Auth and validation
โ”‚   โ”‚   โ””โ”€โ”€ utils/         # Helper functions
โ”‚   โ””โ”€โ”€ package.json        # Backend dependencies
โ”œโ”€โ”€ docs/                   # Project documentation
โ”œโ”€โ”€ scripts/                # Deployment and utility scripts
โ””โ”€โ”€ .github/               # GitHub workflows and templates
    โ”œโ”€โ”€ workflows/           # CI/CD pipelines
    โ””โ”€โ”€ ISSUE_TEMPLATE/      # Issue templates

๐Ÿ”ง Smart Contracts

The core Soroban contracts handle:

  • CredentialRegistry - Stores and verifies educational credentials
  • CourseManager - Manages course creation and enrollment
  • AchievementIssuer - Handles NFT-based achievement badges
  • ProfileManager - Manages on-chain learning profiles

โšก Storage Optimization

Our smart contracts implement advanced storage optimization techniques to reduce gas costs and improve deployment efficiency:

๏ฟฝ Key Optimizations

  1. Bit Packing - Multiple boolean flags and small integers packed into single bytes
  2. Hash-Based Storage - Large strings and vectors stored as hashes to save space
  3. Separate Storage Tiers - Frequently vs infrequently accessed data separated
  4. Packed Timestamps - Creation and update timestamps combined in single U256
  5. Optimized Ratings - Rating values and review counts packed together
  6. Shared Utilities - Common storage patterns abstracted into reusable utilities

๐Ÿ“Š Gas Savings Results

Contract Storage Slots (Before) Storage Slots (After) Reduction Gas Savings
UserProfile 10 6 40% ~2,500 gas
CourseMetadata 17 12 29% ~3,200 gas
Credential 9 7 22% ~1,800 gas
Achievement 7 5 28% ~1,500 gas
Overall 43 30 30% ~9,000 gas

๐Ÿ”ฌ Technical Implementation

// Before: Separate fields
pub struct UserProfile {
    pub created_at: u64,
    pub updated_at: u64,
    pub is_verified: bool,
    pub is_active: bool,
    pub privacy_level: PrivacyLevel,
}

// After: Packed storage
pub struct UserProfile {
    pub timestamps: PackedTimestamps,  // 2 timestamps in 1 U256
    pub flags: PackedUserFlags,       // 5 flags in 1 byte
}

๐Ÿงช Benchmarking

Run gas usage benchmarks:

cd contracts
cargo test --release -- --nocapture test_gas_benchmarks

Generate detailed gas report:

soroban contract invoke \
  --id <contract-id> \
  --fn generate_gas_report \
  --wasm target/wasm32-unknown-unknown/release/starked_education.wasm

๏ฟฝ๐ŸŒ API Endpoints

Authentication

  • POST /api/auth/register - User registration
  • POST /api/auth/login - User authentication
  • POST /api/auth/refresh - Token refresh

Courses

  • GET /api/courses - List available courses
  • POST /api/courses - Create new course
  • GET /api/courses/:id - Course details
  • POST /api/courses/:id/enroll - Enroll in course

Credentials

  • POST /api/credentials/issue - Issue new credential
  • GET /api/credentials/:id - Verify credential
  • GET /api/credentials/user/:address - User credentials

Profiles

  • GET /api/profiles/:address - Learning profile

IPFS Content Management

  • POST /api/content/upload - Upload file to IPFS
  • POST /api/content/upload/batch - Upload multiple files
  • GET /api/content/:cid - Retrieve content from IPFS
  • GET /api/content/:cid/metadata - Get content metadata
  • POST /api/content/:cid/pin - Pin content to IPFS
  • DELETE /api/content/:cid/pin - Unpin content from IPFS
  • GET /api/content/health - Check IPFS service health

Holographic Storage

  • POST /api/holographic/encode - Encode content in holographic format
  • GET /api/holographic/decode/:hash - Decode holographic content
  • POST /api/holographic/access/parallel - High-speed parallel access
  • GET /api/holographic/metrics - Storage density and performance metrics
  • POST /api/holographic/optimize - Optimize storage density

๐Ÿ“ IPFS Integration

StarkEd integrates with IPFS (InterPlanetary File System) for decentralized content storage, providing:

Features

  • File Upload & Storage - Upload educational content to IPFS with metadata
  • Content Retrieval - Retrieve content in multiple formats (buffer, base64, stream)
  • Progress Tracking - Real-time upload progress with WebSocket support
  • Authentication - JWT-based auth with role-based permissions
  • Caching - In-memory caching for improved performance
  • Error Handling - Comprehensive error handling with retry mechanisms

Usage

import ipfsClient from './lib/ipfs';

// Upload a file
const result = await ipfsClient.uploadFile(file, {
  metadata: { course: 'math101' },
  onProgress: (progress) => console.log(`${progress.progress}%`)
});

// Retrieve content
const content = await ipfsClient.getContent(result.cid, 'base64');

Configuration

See backend/.env.example for IPFS configuration options.

For detailed documentation, see IPFS_INTEGRATION_README.md.

๐Ÿ”ฎ Holographic Storage System

StarkEd includes an advanced holographic storage abstraction layer that simulates 3D spatial data storage:

Features

  • 3D Spatial Encoding - Data mapped to interference patterns in 3D space
  • High-Speed Parallel Access - Simultaneous retrieval up to 15,000 MB/s
  • Holographic Compression - Wavelet-based compression (2-3x ratio)
  • Storage Density Optimization - Automatic optimization achieving 80-90% density
  • Hardware-Ready API - Designed for future physical holographic hardware integration

Usage

// Encode educational content
const result = await fetch('/api/holographic/encode', {
  method: 'POST',
  body: JSON.stringify({
    contentId: 'course-101',
    data: Buffer.from(content).toString('base64')
  })
});

// Parallel access for multiple resources
const materials = await fetch('/api/holographic/access/parallel', {
  method: 'POST',
  body: JSON.stringify({ hashes: [hash1, hash2, hash3] })
});

For detailed documentation, see HOLOGRAPHIC_STORAGE_README.md.

Gas Optimization

  • GET /api/gas/benchmarks - View gas usage benchmarks
  • GET /api/gas/report - Generate optimization report
  • GET /api/gas/compare - Compare old vs new storage patterns

๐ŸŽ“ Use Cases

For Students

  • Earn Verifiable Certificates - Complete courses, earn blockchain-verified credentials
  • Build On-Chain Portfolio - Showcase learning history and achievements
  • Lifelong Learning Records - Persistent, portable academic records

For Educators

  • Create Blockchain Courses - Deploy courses with smart contract integration
  • Issue Digital Certificates - Automate credential issuance
  • Track Student Progress - Monitor engagement and completion

For Institutions

  • Verify Credentials Instantly - Eliminate fraud with on-chain verification
  • Reduce Administrative Overhead - Automate certificate management
  • Global Credential Recognition - Cross-border verification

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide for details.

๐Ÿ› Found a Bug?

๐Ÿ’ก Feature Request?

๐Ÿ”’ Security Issue?

๐Ÿ‘ฅ Contributors

Thanks to all our contributors! See the CONTRIBUTORS.md file for details.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐ŸŒŸ Community

๐Ÿ“Š Project Status

  • Version: 0.1.0 (Alpha)
  • Network: Stellar Testnet
  • Status: Under Development
  • Roadmap: View Project Board
  • Gas Optimization: โœ… 30% storage reduction achieved
  • Holographic Storage: โœ… Software abstraction layer implemented
  • Latest Update: Holographic storage system with 3D spatial encoding

๐Ÿ† Optimization Achievements

  • โœ… 30% overall storage reduction across all contracts
  • โœ… Bit packing implementation for boolean flags and small integers
  • โœ… Hash-based storage for large data structures
  • โœ… Separate storage tiers for access pattern optimization
  • โœ… Comprehensive benchmarking suite implemented
  • โœ… Shared storage utilities for code reuse and consistency

๐Ÿ“ˆ Performance Metrics

  • Deployment Gas: Reduced by ~9,000 gas per contract deployment
  • Transaction Gas: 15-25% reduction in average transaction costs
  • Storage Efficiency: 30% fewer storage slots used
  • Code Maintainability: Improved with shared utilities and patterns

โญ Star this repository to support decentralized education on Stellar!

About

Decentralized learning and credential verification platform powered by Stellar blockchain

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors