Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 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
  • 🌐 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

📁 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.

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
  • Latest Update: Storage optimization implementation completed

🏆 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

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages