Skip to content

z1labs/mcp-nft1155-badge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

🪪 Claim Context Badge — MCP ERC-1155 Logic

This repo provides the full claim logic for minting verifiable ERC-1155 badges based on context metadata and MCP eligibility criteria. Users can claim NFTs tied to their onchain or offchain activity — such as interacting with an AI agent, saving context, or reaching a milestone.

🚀 Overview

This module powers the eligibility checks, context validation, and ERC-1155 badge minting flow. It integrates with:

  • Model Context Protocol (MCP)
  • ERC-1155 badge contract
  • Wallet signature or backend-verifiable logic

🔧 Features

  • 🧠 Eligibility checks: verifies model hash, context CID, user address
  • 🖋️ Optional offchain proof verification (agent-signed, snapshot, DB)
  • 🏷️ Mints ERC-1155 NFT with metadata linked to MCP data
  • ⚙️ Supports single-claim per badge ID or reusable logic
  • 🪙 Claim from front-end or script via wallet signature

🧩 Example Claim Flow

  1. User interacts with agent (context is saved)
  2. System generates contextCID and modelHash
  3. Eligibility is evaluated (via backend or onchain logic)
  4. If eligible, contract mints ERC-1155 badge to user wallet
  5. Mint emits VerifiableBadgeMinted with MCP metadata

📦 Installation

npm install
npx hardhat compile

🛠️ Claim Script

await contract.mintBadge(
  userAddress,
  badgeId,
  contextCID,
  modelHash
);

You can also implement signature-based minting:

await contract.claimWithSignature(
  signature,
  badgeId,
  contextCID,
  modelHash
);

🔐 Smart Contract Interfaces

This repo can use or extend the mcp-nft1155-contract.

Function:

function mintBadge(
  address to,
  uint256 badgeId,
  string calldata contextCID,
  bytes32 modelHash
) external;

🔍 Badge Metadata Format

Follows ERC-1155 standard with MCP-specific extensions:

{
  "name": "Memory Saver",
  "description": "Earned by storing context onchain with GPT",
  "image": "ipfs://badge-memory.png",
  "attributes": [
    { "trait_type": "Context CID", "value": "bafy..." },
    { "trait_type": "Model Hash", "value": "0x..." },
    { "trait_type": "Level", "value": "Bronze" }
  ]
}

About

Claim logic for ERC-1155 context badges using Model Context Protocol (MCP). Includes eligibility check, CID verification, and badge minting flow.

Topics

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors