Skip to content

trinhdamhuy/blockchain-degree-management

Repository files navigation

Blockchain Degree Management

This is a Next.js project bootstrapped with create-next-app.

Getting Started

Prerequisites

Make sure you have the following installed on your machine:

Installation

First, install pnpm if you haven't already:

npm install -g pnpm

Next, clone the repository and install the dependencies:

git clone https://github.com/your-username/blockchain-degree-management.git
cd blockchain-degree-management
pnpm install

Environment Variables

Create a .env.local file in the root of your project and add the following environment variables:

# .env.local
PINATA_JWT=your_pinata_jwt
NEXT_PUBLIC_GATEWAY_URL=your_gateway_url
NEXT_PUBLIC_API_URL=your_api_url
CONTRACT_ADDRESS=your_contract_address
CONTRACT_ADDRESS_2=your_contract_address_2

Replace your_pinata_jwt, your_gateway_url, your_gateway_url, your_contract_address, and your_contract_address_2 with your actual values.

Running the Development Server

To start the development server, run:

pnpm dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

Building for Production

To build the project for production, run:

pnpm build

This will create an optimized production build in the out directory.

Running in Production Mode

To run the project in production mode, run:

pnpm start

Using the Application

  1. Connect Wallet: Open the application and connect your wallet.
  2. Authorize Provider: If you are the contract owner, you can authorize a provider by entering their address and clicking "Authorize Provider".
  3. Add Degree: As an authorized provider, you can add a degree by entering the degree details and uploading the degree file.
  4. Search Degree: You can search for a degree by entering the degree ID and clicking "Search Degree".

Updating ABI and Contract Address

To update the ABI and contract address, follow these steps:

  1. Update ABI: Replace the content of the contractABI.json file with the new ABI.

    // ./src/app/(dashboard)/degree/contractABI.json
    {
      "abi": [
        // ...new ABI content...
      ]
    }
  2. Update Contract Address: Update the contract address in the degree.tsx file.

    // ./src/app/(dashboard)/degree/degree.tsx
    const contractAddress = process.env.CONTRACT_ADDRESS;

API Endpoints

Here are the API endpoints used in the project:

  1. Fetch Students: Fetch the list of students.

    GET https://67b5d18b07ba6e59083e9c88.mockapi.io/api/v1/student
  2. Fetch Degree Records: Fetch the degree records by degree ID.

    GET https://67b5d18b07ba6e59083e9c88.mockapi.io/api/v1/degree/{degreeId}
  3. Upload File to Pinata: Upload a file to Pinata and get the IPFS hash and URL.

    POST https://api.pinata.cloud/pinning/pinFileToIPFS

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors