Contract-level metadata

Customizing the metadata for your smart contract

You can add a contractURI method to your ERC-721 or ERC-1155 contract that returns a URL for the collection-level metadata, as specified by ERC-7572.

contract MyCollectible is ERC721 {
    function contractURI() public view returns (string memory) {
        return "ipfs://QmTNgv3jx2HHfBjQX9RnKtxj2xv2xQDtbVXoRi5rJ3a46e";
        // or e.g. https://external-link-url.com/my-contract-metadata.json
    }
}

This URL should return data in the following format:

{
  "name": "OpenSea Creatures",
  "description": "OpenSea Creatures are adorable aquatic beings primarily for demonstrating what can be done using the OpenSea platform. Adopt one today to try out all the OpenSea buying, selling, and bidding feature set.",
  "image": "https://external-link-url.com/image.png",
  "banner_image": "https://external-link-url.com/banner-image.png",
  "featured_image": "https://external-link-url.com/featured-image.png",
  "external_link": "https://external-link-url.com",
  "collaborators": ["0x0000000000000000000000000000000000000000"]
}

You can also encode and return the data within the contract itself:

contract MyCollectible is ERC721 {
    function contractURI() public pure returns (string memory) {
        string memory json = '{"name": "Opensea Creatures","description":"..."}';
        return string.concat("data:application/json;utf8,", json);
    }
}

To signal an update to the contractURI(), emit the event ContractURIUpdated().

To specify creator earnings settings for your contract, set it on the Royalty Registry which OpenSea will use.

Contract Creator Attribution

OpenSea attributes ownership of NFT contracts to their deployers. In some cases, like lazy minting, the sender of the deployment transaction may not be the owner of the contract, and just specifying the owner via ERC-173: Contract Ownership Standard owner() is susceptible to spoofing. OpenSea supports ERC-7015: NFT Creator Attribution to broadcast proof of ownership on contract deployment.

If a factory contract is used to deploy new contracts as opposed to a normal deploy transaction with no to address, the factory contract will need to be added to our internal whitelist to detect the ERC-7015 log - please contact us to do this.