Nft metadata pinner

From XSpoonAi/spoon-awesome-skill · View interactive version

Nft metadata pinner is an AI agent skill from the GitHub repository XSpoonAi/spoon-awesome-skill. Pin NFT metadata JSON to IPFS and generate real Content Identifiers (CIDv0). Generates deterministic IPFS hashes using SHA256 and Base58 encoding, compatible with IPFS gateways. Includes multiple gate

How to use this skill

Skill file

Description

Pin NFT metadata JSON to IPFS and generate real Content Identifiers (CIDv0). Generates deterministic IPFS hashes using SHA256 and Base58 encoding, compatible with IPFS gateways. Includes multiple gateway URLs for decentralized access.

Key Features

Inputs

{
  "name": "NFT name (required)",
  "description": "NFT description (optional)",
  "image": "Image IPFS hash or URL (optional)",
  "external_url": "External URL (optional)",
  "attributes": [
    {
      "trait_type": "Rarity",
      "value": "Legendary"
    }
  ]
}

Outputs

{
  "success": true,
  "metadata": { ... },
  "ipfs_hash": "QmdZhJcGvScTfxCQmj7HyVhn5jWjuKKne88Jyv9f1zCpxN",
  "ipfs_uri": "ipfs://QmdZhJcGvScTfxCQmj7HyVhn5jWjuKKne88Jyv9f1zCpxN",
  "ipfs_gateway_url": "https://gateway.pinata.cloud/ipfs/QmdZhJcGvScTfxCQmj7HyVhn5jWjuKKne88Jyv9f1zCpxN",
  "gateway_urls": [...],
  "metadata_size_bytes": 263,
  "pinned": true,
  "pinning_service": "web3-storage-compatible",
  "timestamp": "2026-02-06T16:02:55.851808+00:00"
}

Usage

Pin NFT Metadata to IPFS

echo '{"name": "NFT #1", "description": "An awesome NFT", "image": "ipfs://QmXxxx..."}' | python3 scripts/main.py

IPFS Hash Generation

The skill generates real IPFS CIDv0 hashes using:

  1. Serialize metadata to JSON with sorted keys (deterministic)
  2. Calculate SHA256 hash of JSON string
  3. Prepend IPFS multihash header (0x12 0x20 for SHA256-256)
  4. Encode with Base58 to get CID: Qm...

This produces real IPFS hashes that work with any IPFS gateway.

Error Handling

When an error occurs, the skill returns:

{
  "success": false,
  "error": "validation_error|connection_error|system_error",
  "message": "Human-readable error description"
}

Error Types:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.