Metadata URI
Your contract must return a URI for the metadata. For ERC-721 contracts, we call the tokenURI
method, and for ERC-1155 contracts, the uri
method. The tokenURI
(ERC-721) or uri
(ERC-1155) should return either an HTTP(S) URL, IPFS URL, or a base64 encoded data URL.
Metadata Structure
We support the following metadata fields, following the official ERC721 metadata standard and the Enjin Metadata suggestions.
image
: Image url for the NFT. This can either be an HTTP(S) URL, and IPFS URL, or base64 encoded image data.
external_url
: External url to view the NFT on your site.
description
: Description for the NFT (can include basic markdown).
name
: Name for the NFT
background_color
: Background color for the image on our platforms. Must be a 6 character hex code without the # symbol.
animation_url
: Animation url for the NFT. This can either be an HTTP(S) URL or IPFS URL. Supported formats include video files, audio files, 3D models, and HTML pages.
attributes
: Array of traits for the NFT. Use trait_type
for the trait name and value
for the associated value. See attributes section for more details.
IPFS
We support IPFS for storing decentralized NFT metadata. If you use IPFS, your URL should be in the format ipfs://<hash>
, e.g. ipfs://QmZYqgu73bpovLt7Y4kYfCPUbbgdRfvcsja8YZsprKismB
.
Attributes
You can include custom attributes
in your metadata for each NFT. As an example, take a look at the attributes for an item in the Octavas collection. The following array of attributes was included in the metadata for this NFT:
"attributes": [
{
"trait_type": "BackgroundColor",
"value": "Grey",
},
{
"trait_type": "BaseColor",
"value": "RGB(228, 32, 27)",
},
{
"trait_type": "BoxAmount",
"value": "Low",
},
{
"trait_type": "LengthOfDrawing",
"value": "41 Frames",
},
{
"trait_type": "Type",
"value": "Chaotic",
},
{
"trait_type": "BoxSize",
"value": "Normal",
},
{
"trait_type": "Outline",
"value": "True",
}
]
Example Metadata
Here's a complete example of formatted metadata for an OptiPunk:
{
"name":"Optipunk #1",
"description":"10,000 unique collectible characters with proof of
ownership stored on Optimism",
"attributes":[
{
"trait_type":"Type",
"value":"Male"
},
{
"trait_type":"Accessory",
"value":"Smile"
},
{
"trait_type":"Accessory",
"value":"Mohawk"
}
], "image":"ipfs://QmbAhtqQqiSQqwCwQgrRB6urGc3umTskiuVpgX7FvHhutU/1.png"