Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tengfei-Ma13206/EduChain

Repository files navigation

EduChain: A Decentralized Certificate Issuance and Verification Platform

EduChain is a blockchain-based project designed to revolutionize how academic certificates are issued, stored, and verified. By leveraging the power of smart contracts on the Ethereum blockchain, it creates a secure, transparent, and immutable system for managing educational credentials.

This platform eliminates the possibility of certificate fraud, simplifies the verification process for employers and institutions, and empowers students with true ownership of their academic achievements.

Core Features

  • Decentralized Issuance: Educational institutions can issue digital certificates as Non-Fungible Tokens (NFTs) on the blockchain.
  • Immutable Record: Each certificate's hash is stored immutably on the blockchain, making it tamper-proof.
  • Instant Verification: Anyone can instantly verify the authenticity of a certificate by interacting with the smart contract, using its unique Token ID and the original document's hash.
  • Student Ownership: Students hold their certificates in their own crypto wallets, giving them full control over their credentials.
  • Simple Frontend: A clean, user-friendly web interface to demonstrate the verification functionality.

Technology Stack

  • Smart Contract: Solidity
  • Blockchain: Ethereum (Sepolia Testnet)
  • Development Environment: Hardhat
  • Libraries: Ethers.js, OpenZeppelin Contracts
  • Frontend: HTML, CSS, Vanilla JavaScript

Project Structure

/
├── contracts/      # Solidity smart contract source code (EduChain.sol)
├── scripts/        # Scripts to deploy and interact with the contract
├── frontend/       # Simple web interface for verification
├── test/           # Contract tests
├── hardhat.config.ts # Hardhat configuration
└── package.json    # Project dependencies and scripts

Getting Started

Follow these instructions to set up and run the project locally.

Prerequisites

1. Clone the Repository

git clone <YOUR_REPOSITORY_URL>
cd EduChain

2. Install Dependencies

Install the required npm packages.

npm install

3. Set Up Environment Variables

You need to create a .env file in the project root to store your private key and RPC endpoint URL.

  1. Copy the example file:
    cp .env.example .env
  2. Open the .env file and add your details:
    SEPOLIA_RPC_URL="https://sepolia.infura.io/v3/YOUR_INFURA_PROJECT_ID"
    SEPOLIA_PRIVATE_KEY="YOUR_WALLET_PRIVATE_KEY"
    

    Security Warning: Never commit your .env file to version control or share your private key.

Usage

1. Compile the Smart Contract

Compile the EduChain.sol contract to generate the ABI and bytecode.

npx hardhat compile

2. Calculate Certificate Hash

To issue a certificate, you first need the Keccak-256 hash of the PDF document.

node scripts/calculate-hash.js path/to/your/certificate.pdf

This will output the hash required for the issue and verify functions.

3. Deploy the Smart Contract

Deploy the contract to the Sepolia testnet.

npx hardhat ignition deploy ignition/modules/EduChain.ts --network sepolia

After a successful deployment, Hardhat Ignition will output the deployed contract address. You will need to copy this address and paste it into the contractAddress variable in the scripts/issue-certificate.js and scripts/verify-certificate.js files.

4. Issue a Certificate

Run the script to issue a new certificate NFT. Make sure to update the studentAddress, tokenId, and certificateHash inside the scripts/issue-certificate.js file first.

node scripts/issue-certificate.js

This will execute a transaction on the Sepolia network. You can view the transaction on a block explorer like Etherscan.

5. Verify a Certificate

To verify a certificate, run the verification script. Ensure the tokenId and certificateHash in scripts/verify-certificate.js match the certificate you want to check.

node scripts/verify-certificate.js

The script will call the verify function on the smart contract and output whether the certificate is valid.

Frontend Application

A simple frontend is available to demonstrate the verification process.

  1. Navigate to the frontend directory:
    cd frontend
  2. Start a local web server:
    python3 -m http.server
  3. Open your browser and go to http://localhost:8000. You can use the interface to verify a certificate.

Contributing

Contributions are welcome! Please feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License.

About

EduChain: A Decentralized Certificate Issuance and Verification Platform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published