NFT Lightning Talk

Ben Beecher

 

What is an NFT

Sample Examples:

Sample examples:


Physical property — houses, unique artwork


Virtual collectables — unique pictures of kittens, collectable cards


"Negative value" assets — loans, burdens and other responsibilities

 

In general, all houses are distinct and no two kittens are alike. NFTs are distinguishable and you must track the ownership of each one separately.

 

ERC 721

Examples in the wild

CryptoKitties

Each Cat has a separate genome + owner

Decentraland

Property is unique and differentiated 

How are they actually distinguished?

 

 

Token id is integer, and unique token location is defined as contractID + TokenID

NFT is very similar to an ERC20 token + a bunch of optional expansions

(missing the decimal value though)

So not a direct extension

Implementation

Details

safeTransferFrom

checks ownership of the sender and is supposed to throw if not an allowed operator

 

function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) external payable;

 

function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;

Wallets must implement

 

function onERC721Received(address _from, uint256 _tokenId, bytes data) external returns(bytes4);

 

To handle incoming assets and can throw to reject transfer

Metadata Expansion 

This allows your smart contract to be interrogated for its name and for details about the assets which your NFT represent

interface ERC721Metadata  {
    function name() external pure returns (string _name);

    function symbol() external pure returns (string _symbol);
    function tokenURI(uint256 _tokenId) external view returns (string);
}

{

    "title": "Asset Metadata",
    "type": "object",
    "properties": {
        "name": {
            "type": "string",
            "description": "Identifies the asset to which this NFT represents",
        },
        "description": {
            "type": "string",
            "description": "Describes the asset to which this NFT represents",
        },
        "image": {
            "type": "string",
            "description": "A URI pointing to a resource with mime type image/* representing the asset to which this NFT represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.",
        }
    }
}

Example metadata:

 

Metadata is not used on chain

Is only accessible via web3 - no usecase for on chain querying of metadata

 

Enumeration Extension

Allows your contract to publish its full list of NFTs and make them discoverable.

 

interface ERC721Enumerable  {
    function totalSupply() external view returns (uint256);

    ///  (sort order not specified)
    function tokenByIndex(uint256 _index) external view returns (uint256);

    ///   (sort order not specified)
    function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);
}

Thanks!

Privacy

 

Ownership of a token is _public_ and that is unchangeable. No such thing as private holder if your wallet id is leaked!

NFTs

By Ben Beecher

NFTs

  • 1,066