Decentralized Course Booking Platform with AI Assistance
Blockchain Tutor is a decentralized course booking platform that leverages Web3 technologies and AI assistance to provide a secure, transparent, and intelligent learning marketplace.
The platform enables:
- Decentralized course management – Courses, enrollments, and transactions are managed via smart contracts, reducing the need for centralized intermediaries.
- Secure payments with Web3 – Students can book courses using crypto wallets (e.g., MetaMask), ensuring transparent and verifiable transactions.
- AI-powered guidance – An integrated AI assistant helps learners discover courses, get personalized recommendations, and ask questions about the platform.
- Ownership and trust – Blockchain-backed records provide tamper-resistant proof of enrollment and course ownership.
This repository contains the frontend and/or backend code (primarily in TypeScript) for interacting with the blockchain, integrating the AI assistant, and building the user interface for learners and instructors.
- Course Marketplace
- Create, list, and manage courses.
- View course details, instructor information, and pricing.
- Decentralized Booking
- Book courses using a Web3 wallet (e.g., MetaMask).
- On-chain records of enrollments and payments.
- AI Assistant
- Helps users find relevant courses.
- Answers common questions and guides users through the booking process.
- Web3 Integration
- Wallet connection and account detection.
- Network status and contract interaction in TypeScript.
- Scalable Architecture
- TypeScript-based project, ready for extension and integration with APIs and smart contracts.
- Language: TypeScript
- Web3: Likely
ethers.jsorweb3.js(adjust as appropriate) - Wallet Integration: MetaMask (via browser extension)
- AI Integration: HTTP-based AI API (e.g., OpenAI or similar; adjust to match your usage)
- Build/Tooling: Node.js, npm/yarn (and optional bundlers like Vite/Webpack)
Update this section to reflect the exact libraries and frameworks you use (e.g., React, Next.js, Express, Hardhat, etc.).
Ensure you have the following installed:
- Node.js (recommended LTS)
- npm (bundled with Node.js) or yarn
- A Web3-enabled browser with MetaMask installed
- (Optional) A testnet or local blockchain (e.g., Hardhat, Ganache, or a public test network like Sepolia/Goerli)
# Clone the repository
git clone https://github.com/soumyadeepsarkar-2004/blockchain-tutor.git
# Enter the project directory
cd blockchain-tutor
# Install dependencies (choose one)
npm install
# or
yarn installIf the project has separate frontend / backend folders, you may need:
cd frontend
npm install
cd ../backend
npm installAdjust as needed for your actual structure.
The project likely uses environment variables for:
- Blockchain RPC settings
- Smart contract addresses
- AI API keys and endpoints
- Application configuration (e.g., app URL, default network)
Create a .env file in the root (or in frontend / backend as applicable), based on a sample file like .env.example (if present). A typical configuration could look like:
# Blockchain / Web3
VITE_RPC_URL=https://sepolia.infura.io/v3/<YOUR_INFURA_PROJECT_ID>
VITE_CHAIN_ID=11155111
VITE_CONTRACT_ADDRESS=0xYourContractAddress
# AI Assistant
VITE_AI_API_KEY=your_ai_api_key_here
VITE_AI_API_BASE_URL=https://api.your-ai-provider.com/v1
# App
VITE_APP_NAME=Blockchain Tutor
VITE_DEFAULT_NETWORK=sepoliaFor a backend service:
RPC_URL=https://sepolia.infura.io/v3/<YOUR_INFURA_PROJECT_ID>
CHAIN_ID=11155111
CONTRACT_ADDRESS=0xYourContractAddress
AI_API_KEY=your_ai_api_key_here
AI_API_BASE_URL=https://api.your-ai-provider.com/v1
PORT=4000Replace names and variables to match your actual code. Never commit real secrets to the repository.
Below is a generic example; update it to match your repository:
blockchain-tutor/
├─ src/
│ ├─ components/ # UI components (e.g., course cards, wallet button)
│ ├─ hooks/ # Custom React/Web3 hooks (e.g., useWallet, useContract)
│ ├─ lib/ # Web3/AI helpers and utilities
│ ├─ pages/ # Page components (if using Next.js or a similar framework)
│ ├─ types/ # TypeScript type definitions
│ └─ index.tsx # Application entry point
├─ contracts/ # Smart contract interfaces or ABIs (if included)
├─ public/ # Static assets
├─ test/ # Tests (unit/integration)
├─ package.json
├─ tsconfig.json
├─ .env.example
└─ README.md
Adjust this tree to reflect the actual layout once finalized.
From the project root (or frontend directory if applicable):
# Development server
npm run dev
# or
yarn devThen open the printed URL in your browser (commonly http://localhost:3000).
- Install the MetaMask browser extension.
- Create or import a wallet.
- Switch to the correct network (e.g., Sepolia testnet or your local network).
- Fund the wallet with test ETH if using a testnet.
- Click “Connect Wallet” or similar button in the app.
- Approve the connection in MetaMask.
- Browse the course catalog on the home page.
- Select a course to see details (description, price, instructor, etc.).
- Click “Book Course”.
- Confirm the transaction in MetaMask (gas fees + course price).
- Wait for the transaction to be mined; your enrollment should appear under “My Courses”.
Depending on your implementation, the AI assistant may appear as:
- A chat widget (e.g., bottom-right of the screen).
- A dedicated “AI Tutor” or “Ask AI” page.
- An integrated sidebar for course pages.
Example usage:
- Ask: “Recommend beginner-level blockchain courses.”
- Ask: “Explain how smart contracts handle course enrollments on this platform.”
- Ask: “Which courses are suitable for learning Solidity basics?”
Below are illustrative TypeScript snippets that you may adapt to match your actual implementation.
// src/lib/contract.ts
import { ethers } from "ethers";
const CONTRACT_ADDRESS = import.meta.env.VITE_CONTRACT_ADDRESS;
const CONTRACT_ABI = [/* ABI JSON here */];
export function getCourseContract() {
if (!window.ethereum) {
throw new Error("MetaMask is not available");
}
const provider = new ethers.BrowserProvider(window.ethereum);
const signer = provider.getSigner();
return new ethers.Contract(CONTRACT_ADDRESS, CONTRACT_ABI, signer);
}// src/lib/courseService.ts
import { getCourseContract } from "./contract";
export async function bookCourse(courseId: number, priceWei: bigint) {
const contract = getCourseContract();
const tx = await contract.bookCourse(courseId, { value: priceWei });
const receipt = await tx.wait();
return receipt;
}// src/lib/aiClient.ts
export async function askAiAssistant(prompt: string): Promise<string> {
const apiKey = import.meta.env.VITE_AI_API_KEY;
const baseUrl = import.meta.env.VITE_AI_API_BASE_URL;
const response = await fetch(`${baseUrl}/chat`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${apiKey}`,
},
body: JSON.stringify({
model: "your-model-id",
messages: [{ role: "user", content: prompt }],
}),
});
if (!response.ok) {
throw new Error("AI request failed");
}
const data = await response.json();
return data.choices?.[0]?.message?.content ?? "";
}If tests are configured, you can run them using:
npm test
# or
yarn testFor TypeScript type checking:
npm run lint
npm run typecheck
# or
yarn lint
yarn typecheckIf you use frameworks like Hardhat or Foundry for smart contracts, typical commands might be:
# Hardhat
npx hardhat test
npx hardhat compileUpdate this section to reflect the actual scripts defined in your package.json.
npm run build
# or
yarn buildThis will create an optimized production build (e.g., in dist/ or .next/, depending on your stack).
Common deployment options:
- Static/SPA Frontend:
- Fullstack / API Backend:
- Deploy to:
- A Node.js server (e.g., on a VPS or container)
- Serverless platforms (e.g., AWS Lambda, Vercel Functions)
- Platform-as-a-Service (e.g., Render, Railway)
- Deploy to:
Steps (generic example):
- Build the project:
npm run build. - Configure environment variables on the hosting platform:
- RPC URL, contract addresses, AI keys, etc.
- Upload or link the repository and follow the provider’s deployment instructions.
Document your exact deployment steps here once your pipeline is finalized.
Contributions are welcome! To contribute:
- Fork the repository.
- Create a feature branch:
git checkout -b feature/your-feature-name
- Make your changes, following the coding standards below.
- Run tests to ensure everything passes.
- Commit your changes with a clear message:
git commit -m "Add feature: brief description" - Push to your fork:
git push origin feature/your-feature-name
- Open a Pull Request against the
mainbranch of this repository.
If you encounter a bug or want to request a feature:
- Open an issue on the GitHub Issues page.
- Include:
- A clear and descriptive title.
- Steps to reproduce (for bugs).
- Expected vs actual behavior.
- Environment details (OS, browser, Node.js version, network, etc.).
- Screenshots or logs if relevant.
- Use TypeScript and keep types explicit where it improves clarity.
- Follow the existing coding style and linting rules.
- Prefer small, focused functions and components.
- Keep Web3 and AI logic modular (e.g., in
lib/orservices/). - Write tests for non-trivial logic when possible.
You may maintain a roadmap in this section. Example items:
- Enhanced analytics for course performance.
- Multi-chain support (e.g., Polygon, Arbitrum).
- On-chain reputation system for instructors and learners.
- Advanced AI features (explanations, quizzes, adaptive learning paths).
- Mobile-friendly layout and PWA support.
No license has been explicitly defined for this project yet.
Until a license is added, all rights are reserved by the repository owner, and reuse or redistribution may require explicit permission.
Once you decide on a license, add a
LICENSEfile (e.g., MIT, Apache 2.0, GPL-3.0) and update this section to reference it.
For questions, suggestions, or collaboration:
- GitHub: soumyadeepsarkar-2004
- Issues: Submit an issue
This README is a structured template tailored to the description of the project. You can refine specific commands, environment variables, and code examples to align with your actual implementation.