Certificate NFT

Certificate NFT

Certificate NFT

A non-transferable NFT smart contract for issuing certificates on the Mandala Chain. This contract allows authorized entities to mint certificate NFTs with metadata and images stored on IPFS.

Features

  • Non-transferable NFTs (Soul-bound tokens)
  • IPFS integration for metadata and images
  • Fully compliant with ERC721 standard
  • Transfer and approval blocking
  • Gas-efficient operations

Contract Architecture

The contract inherits from:

  • ERC721URIStorage
    : For storing token metadata
  • Ownable
    : For access control
Key components:
  • Minting functionality
  • Transfer blocking
  • Approval blocking
  • Metadata generation
  • Event emission

Prerequisites

  • Foundry
  • Access to Mandala Chain RPC
  • IPFS for storing certificate images

Installation

bash
# Clone the repository:
git clone <your-repo-url>
cd certificate-nft

# Install dependencies: 
forge install

# Set up environment variables:
# Create .env file with your configuration
RPC_URL="https://mlg1.mandalachain.io"
PRIVATE_KEY="your-private-key"

# Deployment

bash
# Compile the contract:
forge build

# Deploy to Mandala Chain:
forge create src/CertificateNFT.sol:CertificateNFT \
  --rpc-url "https://mlg1.mandalachain.io" \
  --private-key $PRIVATE_KEY \
  --broadcast

# Minting Certificates

bash
# To mint a new certificate NFT:

# Export contract address
export NFT_CONTRACT="your-contract-address"

# Mint NFT
cast send $NFT_CONTRACT "mintNFT(address,string)" \
  $RECIPIENT_ADDRESS \
  "https://ipfs.io/ipfs/your-image-hash" \
  --rpc-url $RPC_URL \
  --private-key $PRIVATE_KEY

Contract Details

Latest Deployment:

Testing

Run the test suite:
forge test
The tests cover:
  • Basic minting functionality
  • Transfer blocking
  • Approval blocking
  • Owner-only access

Security Features

  1. Non-transferable tokens
    • All transfer functions are blocked
    • NFTs cannot be moved once minted
  2. Access Control
    • Only contract owner can mint certificates
    • All approval functions are blocked
  3. Metadata Integrity
    • On-chain metadata storage
    • Base64 encoded JSON structure
    • IPFS integration for immutable storage