back to projects
June 15, 2024 โ€” 18 mins read
Share:

Building a Decentralized Course Marketplace on Ethereum

๐Ÿš€ ETH Course Marketplace

A comprehensive exploration of blockchain technology, smart contracts, and modern web development

Next.js Solidity Web3.js Ethereum MetaMask

๐ŸŽฏ Project Overview

For my bachelor's degree final project, I developed ETH Course Marketplace - a fully decentralized platform where users can purchase, manage, and access online courses using Ethereum blockchain technology. This project represents the intersection of modern web development, blockchain technology, and user experience design.

๐Ÿ”— Full-Stack Web3

Complete dApp Development

โ›ฝ Gas Optimized

Efficient Smart Contracts

๐ŸŒ Multilingual

Global Accessibility

๐Ÿ“ฑ Responsive

Mobile-First Design

๐Ÿ—๏ธ Technical Architecture

Frontend Stack

  • Next.js 12.3.4 - React framework for production-ready applications
  • React 18.2.0 - Modern component-based UI development
  • Tailwind CSS 3.1.7 - Utility-first CSS framework
  • SWR 1.3.0 - Data fetching library for efficient state management
  • Web3.js 1.7.5 - Ethereum blockchain interaction

Blockchain Stack

  • Solidity - Smart contract development language
  • Truffle Suite - Development framework for Ethereum dApps
  • MetaMask - Browser wallet integration
  • Ethereum Network - Decentralized blockchain platform

โš™๏ธ Core Features Implementation

๐Ÿ” Smart Contract Architecture

The heart of the application is the CourseMarketplace.sol contract implementing state management, ownership verification, and secure transactions.

enum State {
    Purchased,
    Activated, 
    Deactivated
}

struct Course {
    uint id;
    uint price;
    bytes32 proof;
    address owner;
    State state;
}

๐ŸŒ Web3 Integration Layer

Sophisticated Web3 provider system handling wallet connections, network management, and blockchain state synchronization.

const createWeb3State = ({ 
    web3, provider, contract, isLoading 
}) => {
  return {
    web3, provider, contract, isLoading,
    hooks: setupHooks({ web3, provider, contract }),
  };
};

๐ŸŽจ User Interface Components

Component-based architecture with responsive design, interactive modals, and real-time transaction status updates.

  • โ€ข Course catalog with filtering
  • โ€ข Wallet connection interface
  • โ€ข Purchase confirmation modals
  • โ€ข Course management dashboard

๐Ÿงช Testing & Quality Assurance

Comprehensive testing strategy covering smart contracts, purchase flows, access control, and error handling scenarios.

describe("Purchase the new course", () => {
  it("should not allow repurchase", async () => {
    await catchRevert(
      _contract.purchaseCourse(courseId, proof, {
        from: buyer, value
      })
    );
  });
});

๐Ÿ’ก Technical Challenges & Solutions

Challenge 1: Gas Optimization

Problem: High transaction costs affecting user adoption

Solution:

  • Implemented custom errors instead of require statements
  • Optimized storage patterns in smart contracts
  • Batch operations where possible

Challenge 2: Wallet Integration

Problem: Complex MetaMask connection and network switching

Solution:

  • Created abstracted Web3 provider with automatic reconnection
  • Implemented comprehensive error handling for wallet states
  • Added network detection and switching prompts

๐Ÿš€ Future Enhancements

Short-term Improvements

  • Layer 2 Integration (Polygon, Arbitrum) for reduced gas costs
  • IPFS Integration for decentralized course content storage
  • Advanced Filtering with multiple search criteria
  • Rating System with blockchain-based reviews

Long-term Vision

  • DAO Governance for platform decision making
  • Creator Rewards with token-based incentive system
  • Cross-chain Compatibility supporting multiple blockchains
  • AI-Powered Recommendations for personalized course suggestions

๐ŸŽฏ Project Summary

This project represents the culmination of my bachelor's degree studies, showcasing the integration of theoretical computer science knowledge with practical blockchain development skills.

Built with โค๏ธ and โšก as a Bachelor's Degree Final Project

Copyright ยฉ 2025 | All rights reserved /

Made with โค๏ธ in Italy by Amir Seraj.