└── Readme.md /Readme.md: -------------------------------------------------------------------------------- 1 | # InterPlanetary NFT (IPNFT) 2 | 3 | [![hackmd-github-sync-badge](https://hackmd.io/34u90DYHQ86zBFclQUKmVw/badge)](https://hackmd.io/34u90DYHQ86zBFclQUKmVw) 4 | 5 | 6 | ## Simple Summary 7 | 8 | A standard encoding and addressing for non-fungible tokens (NFTs) for upholding chain immutablity gurantees off chain. 9 | 10 | 11 | ## Abstract 12 | 13 | Following standard defines a standard encoding for [ERC-721][] Non-Fungible Token assets & metadata (addressed by `tokenURI`) which is compatible with the existing specification, while it attempts to address some of the issues found in the wild. 14 | 15 | ## Motivation 16 | 17 | [ERC-721][]: Non-Fungible Token Standard defines `tokenURI` as a distinct Uniform Resource Identifier (URI) for a given asset where it **may** point to a JSON file that conforms to the "ERC721 Metadata JSON Schema". 18 | 19 | Metadata schema in turn defines `name`, `description` and `image` string fields, where `image` is a URI pointing to a resource with mime type `image/*` representing the asset to which this NFT represents. 20 | 21 | Loose requirements lead to number of problems in the wild: 22 | 23 | - **Autheticity** - Many NFTs use URIs to web 2.0 host that 24 | 1. Can go down and make assets inaccessible (404) 25 | 2. Serve unauthentic resource for maliciously or unintentionally. 26 | - **Ambiguity** - While specification only defines `image` field for the asset, in practice many new fields with URI are used. This introduces ambiguity in which URIs are part of NFT asset and which are not. 27 | 28 | 29 | IPNFT specification defines [IPLD][] format for encoding NFT metadata and all the assets into a hash linked [DAG][] which can be addressed via `ipfs://` URLs and used in `tokenURI` in ERC-721 compatible way while addressing outlined problems as follows: 30 | 31 | - **Autheticity** - Content addressing of IPFS guarantees that content can be retreived from arbitrary nodes in the network and that content is verifiably be authentic. 32 | - **Ambiguity** - All sssets included in the DAG are part of NFT any URL inside the metadata is not. 33 | 34 | ## Specification 35 | 36 | The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119. 37 | 38 | ## Asset Link 39 | 40 | MUST be an IPLD link to [DAG-PB] directory, which SHOULD contain exactly one named file. 41 | 42 | ## IPNFT 43 | 44 | Every IPNFT MUST be [DAG-CBOR][] encoded data structure which MUST have: 45 | 46 | 1. `type` property with `"nft"` value. 47 | 1. `name` property with a string vaule. 48 | 1. `description` property with a string value. 49 | 1. Have `image` [asset link](#Asset-Link). 50 | 51 | 52 | IPFNT data structure MAY contain arbitrary other properties however it is RECOMMENDED to put those under `properties` as per "ERC721 Metadata JSON Schema". 53 | 54 | All NFT assets MUST be included in IPNFT data structure as [asset links](#Asset-Link) which MAY be any top level property except (`type`, `name`, `description`, `image`, `properties`, `metadata.json`) or any nested property. 55 | 56 | 57 | ### `metadata.json` content 58 | 59 | It is RECOMMENDED for IPNFT to have a `metadata.json` IPLD link to a JSON source in [DAG-PB][] or RAW encoding mirroring IPNFT data structure with following caveats: 60 | 61 | 1. `type` property is OPTIONAL and can be omitted. If present it MUST have value `"nft"`. 62 | 2. Asset links MUST be substituted for corresponding `ipfs://{asset_cid}/file.png` URLs in string format _(substitute `file.png` with actual file name)_. 63 | 3. SHOULD NOT have a property named `metadata.json` so it does not diverge from IPNFT data structure. 64 | 65 | 66 | ## Caveats 67 | 68 | 1. IPNFT root block should not exceed 1MiB in size. 69 | 70 | > Larger blocks are not well supported by IPFS. If CBOR encoded metadata still exceeds this block limit author shoud consider refatoring metadata into multiple block e.g. taking JSON substructure, encoding it in DAG-CBOR and linking to it from metadata. 71 | 72 | 73 | [ERC-721]:https://eips.ethereum.org/EIPS/eip-721 74 | [IPLD]:https://ipld.io/ 75 | [DAG]:https://en.wikipedia.org/wiki/Directed_acyclic_graph 76 | [DAG-CBOR]:https://ipld.io/docs/codecs/known/dag-cbor/ 77 | [DAG-PB]:https://ipld.io/docs/codecs/known/dag-pb/ --------------------------------------------------------------------------------