Modules
None Fungible

NFT Module Documentation for the Synnq Ecosystem

Overview

The NFT Module in the Synnq Ecosystem is responsible for the creation, management, and storage of Non-Fungible Tokens (NFTs). It provides functionalities to mint, transfer, and burn NFTs, as well as to retrieve NFTs by their owner or associated contracts. The module integrates with the network’s transaction system and smart contracts, ensuring that NFT operations are secure, traceable, and consistent with the decentralized nature of the Synnq ecosystem.


Components and Responsibilities

1. NFT (NFT)

NFTs represent unique digital assets on the blockchain. Each NFT is associated with specific metadata that describes the asset, including attributes like name, description, and image URI.

Key Attributes:

  • ID: A unique identifier for the NFT, generated using UUID.
  • Owner: The address of the wallet that owns the NFT.
  • Metadata: Structured information about the NFT, such as name, description, and image URI.
  • Created At: The timestamp indicating when the NFT was minted.
  • Is Burned: A flag that indicates whether the NFT has been burned and is no longer in circulation.

2. Metadata (Metadata)

Metadata is a crucial component of an NFT, providing additional context and information about the asset.

Key Attributes:

  • Name: The name of the NFT.
  • Description: A textual description of the NFT.
  • Image URI: A link to an image that represents the NFT.

3. NFT Module (NFTModule)

The NFTModule struct manages the lifecycle of NFTs, including minting, transferring, burning, and retrieving NFTs. It interacts with the storage system and mempool to handle the persistence and transaction processing of NFTs.

Key Functionalities:

  • Minting NFTs: Creates a new NFT and assigns it to a specified owner.
  • Transferring NFTs: Changes the ownership of an NFT from one wallet to another.
  • Burning NFTs: Permanently destroys an NFT, making it unusable and non-transferable.
  • Retrieving NFTs: Allows querying NFTs by their ID, owner, or associated contract.
  • Contract Interaction: Associates NFTs with smart contracts, enabling advanced functionalities like automated transactions.

4. Storage and Mempool Integration

The NFTModule interacts with the network's storage system to persist NFT data and with the mempool to manage pending transactions related to NFTs.

Key Operations:

  • Store NFT: Saves the NFT data in persistent storage.
  • Retrieve NFT: Fetches NFT data from storage based on its ID.
  • Update NFT: Modifies existing NFT data in storage, typically used after a transfer or burn operation.
  • Mempool Transactions: Manages transactions involving NFTs, including minting, transferring, and burning, by adding them to the mempool for processing.

Use Cases and Workflows

NFT Minting

  1. Mint an NFT:

    • A user initiates the minting process by providing the owner’s address, metadata, and private key.
    • The NFTModule generates a new NFT with a unique ID, assigns the provided metadata, and stores the NFT in the system.
    • The NFT is associated with a smart contract, and a transaction is created and added to the mempool to record the minting event.
  2. Store the NFT:

    • The newly minted NFT is persisted in the storage system, ensuring that it is retrievable and securely stored.

NFT Transfer

  1. Transfer an NFT:

    • A user requests the transfer of an NFT to a new owner by providing the NFT ID, new owner’s address, and private key.
    • The NFTModule retrieves the NFT, updates its ownership, and stores the updated NFT in the storage system.
    • A transaction is created to record the transfer event, and it is added to the mempool for processing.
  2. Update the Storage:

    • The NFT’s ownership is updated in the storage system, and the NFT remains associated with the same contract.

NFT Burning

  1. Burn an NFT:

    • A user initiates the burning process by providing the NFT ID and private key.
    • The NFTModule retrieves the NFT, marks it as burned, and removes its association with the contract.
    • A transaction is created to record the burning event, and it is added to the mempool for processing.
  2. Remove Contract Association:

    • The NFT is disassociated from any contracts, and its status is updated in the storage system to reflect that it has been burned.

Error Handling and Security

The NFT Module includes comprehensive error handling to manage scenarios like missing NFTs, failed storage operations, and transaction errors. Each operation logs detailed information for transparency and debugging, ensuring the integrity and traceability of NFT operations. The use of cryptographic signatures ensures that only authorized users can perform operations like minting, transferring, or burning NFTs.