CERTHUB
Documentation

CERTHUB Documentation

CERTHUB is a blockchain-based platform for issuing, claiming, and verifying certificates on the Hyperion Explorer. This documentation covers the smart contract functionality, user interface workflows, input requirements, and precautions for users.

Table of Contents

Overview

CERTHUB leverages the Hyperion Testnet to provide a secure, transparent, and tamper-proof system for certificate management. Institutions issue soulbound (non-transferable) certificates, recipients claim them using Merkle proofs, and anyone can verify claims or inspect certificate details. The platform ensures authenticity through institution verification and blockchain immutability.

Key features include institution registration, certificate issuance and updates, claim verification, and profile management. The smart contracts enforce access control, while the UI provides an intuitive interface for all users.

Smart Contract Functions

The core functionality resides in the `CredentialsAndCertificatesFactoryContract` and `ICredentialsAndCertificatesImplementation` contracts, deployed on the Hyperion Testnet. Below are the primary functions:

registerInstitution

Registers a new institution, restricted to factory agents.

function registerInstitution(
  address institutionWalletAddress,
  string calldata institutionName
) public onlyFactoryAgent {
  // Stores in verified_institutions mapping
}

Inputs: Institution wallet address (e.g., `0x123...`), institution name (e.g., `Harvard`).
Output: Emits `InstitutionRegistered` event.

issueCertificate

Issues a new certificate, restricted to verified institutions or admins.

function issueCertificate(
  address institutionWalletAddress,
  string calldata institutionName,
  string calldata certificateName,
  string calldata certificateId,
  string calldata uri,
  uint256 certificateYear,
  bytes32 merkleRoot,
  uint256 certificateTokenQuantity
) public onlyVerifiedInstitutionOrAdmin(institutionName, institutionWalletAddress) {
  // Deploys certificate contract, stores in institution_certificates
}

Inputs: Institution wallet address, institution name, certificate name (e.g., `Bachelor of Science`), certificate ID (e.g., `CERT123`), URI (e.g., `ipfs://Qm...`), year (e.g., `2023`), Merkle root (32-byte hex), token quantity (e.g., `100`).
Output: Emits `CertificateIssued` event.

updateCertificate

Updates an existing certificate’s details, restricted to verified institutions or admins.

function updateCertificate(
  address institutionWalletAddress,
  string calldata institutionName,
  string calldata previousCertificateName,
  string calldata certificateName,
  string calldata certificateId,
  string calldata uri,
  uint256 previousCertificateYear,
  uint256 newCertificateYear,
  bytes32 merkleRoot,
  uint256 certificateTokenUpdateQuantity
) public onlyVerifiedInstitutionOrAdmin(institutionName, institutionWalletAddress) {
  // Updates certificate details via institution_certificates mapping
}

Inputs: Institution wallet address, institution name, previous certificate name, new certificate name, certificate ID, URI, previous year, new year, Merkle root, token quantity.
Output: Emits `CertificateUpdated` event.

verifyCertificate

Verifies a recipient’s certificate claim, public function.

function verifyCertificate(
  address recipientAddress,
  string calldata certificateName,
  uint256 certificateYear,
  address institutionWalletAddress
) public view returns (Recipient memory details) {
  // Returns Recipient struct with claim details
}

Inputs: Recipient address, certificate name, certificate year, institution wallet address.
Output: `Recipient` struct (`RecipientName`, `CertificateName`, `CertificateYear`, `CertificateId`, `RecipientId`, `InstitutionName`, `Claimed`).

claimCertificate (Assumed)

Allows recipients to claim a certificate using a Merkle proof.

function claimCertificate(
  address recipientAddress,
  string calldata certificateId,
  string calldata institutionName,
  bytes32[] calldata merkleProof
) public {
  // Verifies Merkle proof and marks claim in certificate contract
}

Inputs: Recipient address, certificate ID, institution name, Merkle proof (array of 32-byte hex strings).
Output: Emits `CertificateClaimed` event.

expandCertificateDetails (Assumed)

Retrieves detailed certificate information, public function.

function expandCertificateDetails(
  address institutionWalletAddress,
  string calldata certificateName,
  uint256 certificateYear
) public view returns (string memory certificateId, string memory uri, bytes32 merkleRoot, uint256 tokenQuantity) {
  // Returns certificate metadata
}

Inputs: Institution wallet address, certificate name, certificate year.
Output: Certificate ID, URI, Merkle root, token quantity.

UI Workflows

The CERTHUB UI provides intuitive pages for interacting with the smart contracts. Below are the main workflows:

Register Institution (/register)

Factory agents register institutions to allow them to issue certificates.

  • Navigate to /register.
  • Connect a factory agent wallet (e.g., `0x85E12F2100554D46b498D887a83ABBf9C42fF951`).
  • Enter institution wallet address and name.
  • Submit to register the institution.

Issue Certificate (/issue)

Verified institutions or admins issue new certificates with Merkle proofs for recipients.

  • Navigate to /issue.
  • Connect an institution admin wallet.
  • Enter institution details, certificate details (name, ID, URI, year, token quantity), and recipient addresses.
  • Generate a Merkle root and download proofs via the UI.
  • Submit to deploy the certificate contract.

Update Certificate (/agent/update-certificate)

Verified institutions or admins update existing certificate details.

  • Navigate to /agent/update-certificate.
  • Connect an institution admin wallet.
  • Enter institution name, previous certificate details (name, year), and updated details (name, ID, URI, year, Merkle root, token quantity).
  • Optionally generate a new Merkle root and download proofs.
  • Submit to update the certificate.

Claim Certificate (/claim)

Recipients claim their certificates using a Merkle proof.

  • Navigate to /claim.
  • Connect the recipient’s wallet.
  • Enter certificate ID, institution name, and upload or paste the Merkle proof.
  • Submit to claim the certificate.

Verify Certificate Claim (/verify)

Anyone can verify a recipient’s certificate claim.

  • Navigate to /verify.
  • Enter institution wallet address, certificate name, certificate year, and recipient address.
  • Submit to view claim details (e.g., Recipient Name, Certificate ID, Claimed status).

Inspect Certificate (/inspect)

View detailed certificate metadata.

  • Navigate to /inspect.
  • Enter institution wallet address, certificate name, and certificate year.
  • Submit to view certificate details (e.g., ID, URI, Merkle root).
  • Note: This feature may encounter issues (e.g., `CALL_EXCEPTION`); check logs for debugging.

View Profiles (/profile)

View institution or recipient profiles, including issued or claimed certificates.

  • Navigate to /profile.
  • Connect a wallet to view your profile or enter an address to view another’s.
  • Displays issued certificates (for institutions) or claimed certificates (for recipients).

Input Guidelines

Accurate inputs are critical for successful contract interactions. Below are guidelines for each input type:

  • Ethereum Addresses (e.g., `institutionWalletAddress`, `recipientAddress`): Must be valid 40-character hexadecimal strings prefixed with `0x` (e.g., `0x1234567890abcdef1234567890abcdef12345678`). Use wallets like MetaMask.
  • Institution Name: A string identifying the institution (e.g., `Harvard`). Must match the registered name exactly for restricted functions.
  • Certificate Name: A string describing the certificate (e.g., `Bachelor of Science`). Case-sensitive and must match existing records for updates/verification.
  • Certificate ID: A unique string identifier (e.g., `CERT123`). Avoid spaces or special characters unless supported.
  • URI: A link to certificate metadata, typically an IPFS URL (e.g., `ipfs://Qm...`). Ensure the link is accessible.
  • Certificate Year: A positive integer (e.g., `2023`). Use four digits for consistency.
  • Merkle Root: A 32-byte hexadecimal string prefixed with `0x` (e.g., `0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef`). Generated via the UI’s `/api/merkle` endpoint.
  • Merkle Proof: An array of 32-byte hex strings (e.g., `["0x123...", "0x456..."]`). Upload a JSON file from `/issue` or `/update-certificate` or paste manually.
  • Token Quantity: A positive integer (e.g., `100`). Represents the number of certificate tokens issued or updated.

Precautions

To ensure smooth interaction with CERTHUB, follow these precautions:

  • Wallet Connection: Connect a wallet via MetaMask for actions requiring transactions (e.g., `/register`, `/issue`, `/claim`, `/agent/update-certificate`). Ensure the wallet is on the Hyperion Testnet.
  • Network: Switch to the Hyperion Testnet (RPC: `https://hyperion-testnet.metisdevops.link`) in MetaMask. Mismatched networks cause errors.
  • Access Control: Only factory agents can access `/register`. Only verified institution admins can access `/issue` and `/agent/update-certificate`. Verify your wallet’s permissions via the contract’s `institution_admins` mapping.
  • Input Accuracy: Double-check addresses, names, and years. Errors like “Certificate address lookup failed” occur if inputs don’t match contract records.
  • Merkle Proofs: Ensure proofs match the certificate’s Merkle root. Use the downloaded JSON from `/issue` or `/update-certificate`.
  • Gas Fees: Hyperion .
  • Error Handling: Common errors include “Certificate address lookup failed” (invalid certificate details), “Unauthorized” (access control), or `CALL_EXCEPTION` (contract issues). Check console logs for details.
  • Testing: Use test data (e.g., factory agent `0x85E12F2100554D46b498D887a83ABBf9C42fF951`) on Hyperion Testnet to avoid real-world consequences.

Fetching Data

CERTHUB allows users to retrieve certificate and claim data via public `view` functions and UI pages:

  • Verify a Claim (/verify): Use `verifyCertificate` to check if a recipient has claimed a certificate. Returns a `Recipient` struct with details like `RecipientName`, `CertificateId`, and `Claimed` status.
  • Inspect Certificates (/inspect): Use `expandCertificateDetails` to retrieve certificate metadata (ID, URI, Merkle root, token quantity). Note: Debug `CALL_EXCEPTION` if errors occur.
  • Profiles (/profile): View issued or claimed certificates for an institution or recipient. Query `institution_certificates` or `claimedCertificates` mappings.
  • Contract Queries: Use `ethers.js` or similar to call `view` functions directly:
    const provider = new ethers.JsonRpcProvider("https://hyperion-testnet.metisdevops.link");
    const contract = new ethers.Contract("0xC04b063F5Fd9F03B67359DE79d3b18a55f73cB0c", ABI, provider);
    const details = await contract.verifyCertificate("0x123...", "Bachelor of Science", 2023, "0x456...");
    console.log(details); // Recipient struct
    
  • Event Logs: Monitor events like `CertificateIssued`, `CertificateUpdated`, or `CertificateClaimed` using ethers.js or a blockchain explorer for transaction history.