ERGO
Token Mechanics
Beginner
30 minutes

NFT Minting on Ergo (Non-Fungible EIP-4)

Mint a unique NFT with on-chain metadata and image hash

GitHub

Problem

You need to create a unique, non-fungible digital asset with provable scarcity and verifiable authenticity.

Çözüm

NFTs on Ergo are tokens with quantity = 1. The unique token ID combined with EIP-4 metadata registers provides authenticity. Content hash in R8 enables verification against the actual file.

Nasıl Çalışır

  1. 1Create transaction with unique first input (ensures unique token ID)
  2. 2First output mints token with amount = 1 (non-fungible)
  3. 3R4-R6: Name, description, decimals (0 for NFT)
  4. 4R7: Asset type (0x0e01 for NFT picture, 0x0e02 for audio, etc.)
  5. 5R8: SHA-256 hash of the content file
  6. 6R9: Content URL (IPFS, Arweave, or other permanent storage)

Kod Örnekleri

{
  // NFT = token with quantity 1
  // EIP-4 Extended Register Layout for NFTs:
  // R4: Name (UTF-8 string)
  // R5: Description (UTF-8 string)  
  // R6: Decimals = 0 (always for NFT)
  // R7: Asset type byte:
  //     0x01 = picture (PNG/JPG/GIF/WEBP)
  //     0x02 = audio (MP3/WAV/OGG)
  //     0x03 = video (MP4/WEBM)
  //     0x04 = 3D model (GLB/GLTF)
  // R8: SHA-256 hash of content (for verification)
  // R9: Content URL (ipfs://... or ar://...)
  
  // Only creator can mint
  proveDlog(creatorPK)
}

EIP-4 extended layout for NFTs. The content hash in R8 allows anyone to verify the NFT points to the correct file.

Kullanım Alanları

  • Digital art collectibles
  • Gaming items and characters
  • Event tickets with proof of attendance
  • Membership passes and access tokens
  • Music and video NFTs
  • Domain names and identity tokens

Güvenlik Hususları

  • !Always store content on permanent storage (IPFS, Arweave)
  • !Include content hash for authenticity verification
  • !Verify hash matches content before purchase
  • !Consider royalty mechanisms for secondary sales

Gerçek Dünya Uygulamaları

SkyHarbor

NFT marketplace

ErgoAuctions

NFT auction house

Kaynaklar

Ücret Hususları

Standard transaction fee. Consider IPFS pinning costs for content storage.

ErgoScript Becerilerinizi Geliştirin

Yeni kalıplar, öğretici içerikler ve geliştirici kaynakları hakkında bildirim alın.

Follow for daily updates