Pseudo-code for an NFT contract that:
- Allows "minting" (creation of a token)
- Allows "transfer" (moving token from wallet A to B)
- Allows querying the "current owner of a token"
- Allows querying the "metadata" of a token (often just a IPFS hash which points to media + info)
This example is meant to illustrate some of the core concepts behind ERC 721, which is the basis for most NFTs we trade today.
Usually the metadata is a single hash string such as 13ZcYQ53Fh9ESxbiuE827QkvikG6NK8n25cdmWHsKCtF61
, which is the output from hashing a metadata JSON, roughly something like:
{
"name": "My Cool NFT",
"description": "Description of the coolest NFT",
"media": "ipfs://QmWc6YHE815F8kExchG9kd2uSsv7ZF1iQNn23bt5iKC6K3"
}