This is a Next.js project bootstrapped with create-next-app.
Make sure you have the following installed on your machine:
First, install pnpm if you haven't already:
npm install -g pnpmNext, clone the repository and install the dependencies:
git clone https://github.com/your-username/blockchain-degree-management.git
cd blockchain-degree-management
pnpm installCreate 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_2Replace your_pinata_jwt, your_gateway_url, your_gateway_url, your_contract_address, and your_contract_address_2 with your actual values.
To start the development server, run:
pnpm devOpen 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.
To build the project for production, run:
pnpm buildThis will create an optimized production build in the out directory.
To run the project in production mode, run:
pnpm start- Connect Wallet: Open the application and connect your wallet.
- Authorize Provider: If you are the contract owner, you can authorize a provider by entering their address and clicking "Authorize Provider".
- Add Degree: As an authorized provider, you can add a degree by entering the degree details and uploading the degree file.
- Search Degree: You can search for a degree by entering the degree ID and clicking "Search Degree".
To update the ABI and contract address, follow these steps:
-
Update ABI: Replace the content of the
contractABI.jsonfile with the new ABI.// ./src/app/(dashboard)/degree/contractABI.json { "abi": [ // ...new ABI content... ] }
-
Update Contract Address: Update the contract address in the
degree.tsxfile.// ./src/app/(dashboard)/degree/degree.tsx const contractAddress = process.env.CONTRACT_ADDRESS;
Here are the API endpoints used in the project:
-
Fetch Students: Fetch the list of students.
GET https://67b5d18b07ba6e59083e9c88.mockapi.io/api/v1/student
-
Fetch Degree Records: Fetch the degree records by degree ID.
GET https://67b5d18b07ba6e59083e9c88.mockapi.io/api/v1/degree/{degreeId} -
Upload File to Pinata: Upload a file to Pinata and get the IPFS hash and URL.
POST https://api.pinata.cloud/pinning/pinFileToIPFS
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
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.