|
| 1 | +# Collection |
| 2 | + |
| 3 | +This standard defines how **Collections** of NFTs are minted. Collections cannot be sent and are |
| 4 | +effectively immutable after being created, with the exception of the issuer value. The current |
| 5 | +issuer of the collection can assign a new issuer using a CHANGEISSUER interaction. |
| 6 | + |
| 7 | +## Collection Standard |
| 8 | + |
| 9 | +A collection MUST adhere to the following standard. |
| 10 | + |
| 11 | +```json |
| 12 | +{ |
| 13 | + "name": { |
| 14 | + "type": "string", |
| 15 | + "description": "Name of the collection. Name must be limited to alphanumeric characters. Underscore is allowed as word separator. E.g. VALHELLO-ITEMS is NOT allowed. VALHELLO_ITEMS is allowed." |
| 16 | + }, |
| 17 | + "max": { |
| 18 | + "type": "number", |
| 19 | + "description": "How many NFTs will ever belong to this collection. 0 for infinite." |
| 20 | + }, |
| 21 | + "issuer": { |
| 22 | + "type": "string", |
| 23 | + "description": "Issuer's address, e.g. CpjsLDC1JFyrhm3ftC9Gs4QoyrkHKhZKtK7YqGTRFtTafgp. Can be address different from minter." |
| 24 | + }, |
| 25 | + "symbol": { |
| 26 | + "type": "string", |
| 27 | + "description": "Ticker symbol by which to represent the token in wallets and UIs, e.g. ZOMB" |
| 28 | + }, |
| 29 | + "id": { |
| 30 | + "type": "string", |
| 31 | + "description": "A collection is uniquely identified by the first four and last four bytes of the original issuer's pubkey and the symbol. This prevents anyone but the issuer from reusing the symbol, and prevents trading of fake NFTs with the same symbol. Example ID: 0aff6865bed3a66b-ZOMB." |
| 32 | + }, |
| 33 | + "metadata?": { |
| 34 | + "type": "string", |
| 35 | + "description": "HTTP(s) or IPFS URI. If IPFS, MUST be in the format of ipfs://ipfs/HASH" |
| 36 | + }, |
| 37 | + "data?": { |
| 38 | + "type": "object", |
| 39 | + "description": "See Data" |
| 40 | + } |
| 41 | +} |
| 42 | +``` |
| 43 | + |
| 44 | +When either metadata or [data](#data) is present, the other is optional. Data takes precedence |
| 45 | +always. Note that because metadata contains description, attributes, third party URLs, etc. it is |
| 46 | +still recommended to include it alongside `data`. |
| 47 | + |
| 48 | +### Data |
| 49 | + |
| 50 | +The `data` object is composed of: |
| 51 | + |
| 52 | +- protocol (strict, see Protocols below) |
| 53 | +- data |
| 54 | +- type (mime type) |
| 55 | + |
| 56 | +#### Protocols |
| 57 | + |
| 58 | +| Protocol | Mime default | Description | |
| 59 | +| --------- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | |
| 60 | +| `ipfs` | image/png | Points to a directly interpretable resource, be it audio, video, code, or something else | |
| 61 | +| `http(s)` | image/html | Points to a directly interpretable resource, be it audio, video, code, or something else (not recommended for use) | |
| 62 | +| `p5` | application/javascript | Processing.js code | |
| 63 | +| `js` | application/javascript | Plain JS code | |
| 64 | +| `html` | text/html | HTML code, no need for `<html>` and `<body>`, can support dependencies but it's up to the author to prevent the dependencies from disappearing | |
| 65 | +| `svg` | image/svg+xml | SVG image data | |
| 66 | +| `bin` | n/a | binary, directly interpretable | |
| 67 | + |
| 68 | +## Metadata |
| 69 | + |
| 70 | +A collection SHOULD have metadata to describe it and help visualization on various platforms. |
| 71 | + |
| 72 | +```json |
| 73 | +{ |
| 74 | + "description": { |
| 75 | + "type": "string", |
| 76 | + "description": "Description of the collection as a whole. Markdown is supported." |
| 77 | + }, |
| 78 | + "attributes": { |
| 79 | + "type": "array", |
| 80 | + "description": "An Array of JSON objects, matching OpenSea's: https://docs.opensea.io/docs/metadata-standards#section-attributes" |
| 81 | + }, |
| 82 | + "external_url": { |
| 83 | + "type": "string", |
| 84 | + "description": "HTTP or IPFS URL for finding out more about this project. If IPFS, MUST be in the format of ipfs://ipfs/HASH" |
| 85 | + }, |
| 86 | + "image": { |
| 87 | + "type": "string", |
| 88 | + "description": "HTTP or IPFS URL to project's main image, in the vein of og:image. If IPFS, MUST be in the format of ipfs://ipfs/HASH" |
| 89 | + }, |
| 90 | + "image_data": { |
| 91 | + "type": "string?", |
| 92 | + "description": "[OPTIONAL] Use only if you don't have the image field (they are mutually exclusive and image takes precedence). Raw base64 or SVG data for the image. If SVG, MUST start with <svg, if base64, MUST start with base64:" |
| 93 | + } |
| 94 | +} |
| 95 | +``` |
| 96 | + |
| 97 | +## Examples |
| 98 | + |
| 99 | +Collection: |
| 100 | + |
| 101 | +```json |
| 102 | +{ |
| 103 | + "name": "Dot Leap Early Promoters", |
| 104 | + "max": 100, |
| 105 | + "issuer": "CpjsLDC1JFyrhm3ftC9Gs4QoyrkHKhZKtK7YqGTRFtTafgp", |
| 106 | + "symbol": "DLEP", |
| 107 | + "id": "0aff6865bed3a66b-DLEP", |
| 108 | + "metadata": "ipfs://ipfs/QmVgs8P4awhZpFXhkkgnCwBp4AdKRj3F9K58mCZ6fxvn3j" |
| 109 | +} |
| 110 | +``` |
| 111 | + |
| 112 | +Metadata: |
| 113 | + |
| 114 | +```json |
| 115 | +{ |
| 116 | + "description": "Everyone who promoted [Dot Leap](https://dotleap.substack.com) via the in-email Tweet link is eligible.", |
| 117 | + "attributes": [], |
| 118 | + "external_url": "https://rmrk.app/registry/0aff6865bed3a66b-DLEP", |
| 119 | + "image": "ipfs://ipfs/QmYcWFQCY1bAZ7ffRggt367McMN5gyZjXtribj5hzzeCWQ" |
| 120 | +} |
| 121 | +``` |
0 commit comments