PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, July 28, 2022

[FIXED] How is a NFT Token ID assigned to an object (e.g., picture, tweet, video, etc.)

 July 28, 2022     blockchain, ethereum, nft     No comments   

Issue

Background: Suppose I want to verify the ownership of some tweet or some picture by looking up the data in the blockchain. If my understanding is correct, I need to be able to assign a unique tokenId that represents that tweet/picture.

Question 1: Is there some standardization on how this ID is assigned? Do different platform perform this mapping in a unique way? I feel like without such a standardization, the non-fungibility becomes questionable (e.g., do you really own this tweet, or do you only own it if you apply the tweet->token ID mapping you crafted yourself?).

Question 2: Could you provide a few examples of how exactly is the token ID assigned to some (well-known) NFTs?


Solution

Is there some standardization on how this ID is assigned?

The ERC-721 standard explicitly states that there is no standard to assign the ID (except for the uint256 datatype):

While some ERC-721 smart contracts may find it convenient to start with ID 0 and simply increment by one for each new NFT, callers SHALL NOT assume that ID numbers have any specific pattern to them, and MUST treat the ID as a “black box”.


e.g., do you really own this tweet, or do you only own it if you apply the tweet->token ID mapping

Token ownership does not mean that you own the underlying resource. It only means that you own the token (representing the resource).


Could you provide a few examples of how exactly is the token ID assigned to some (well-known) NFTs?

  • CryptoKitties - link, line 412, incrementing

    uint256 newKittenId = kitties.push(_kitty) - 1;
    
  • CryptoPunks - link, lines 73 and 83, assigning ID set by the (authorized) caller

    mapping (uint => address) public punkIndexToAddress;
    
    function setInitialOwner(address to, uint punkIndex) {
        // ...
        punkIndexToAddress[punkIndex] = to;
    


Answered By - Petr Hejda
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing