Listing Beranames on NFT Marketplaces

How to integrate Beranames NFTs secondary market metadata?

You can integrate NFTs secondary market metadata following the steps below:

  1. Fetch the URI endpoint to call from the tokenURI(uint256 tokenId) function of the BaseRegistrar contract.

    • Where tokenId is the token ID of the NFT - uint256(keccak256(bytes("label"))).

    • The function returns the metadata endpoint to call for the NFT.

  2. Fetch the metadata from the endpoint.

    • you can expect the metadata to be in the format of a JSON file:

{
    "name": "Name",
    "address": "0x1234567890abcdef",
    "image": "https://example.com/image.png",
    "registration_date": "DATE_IN_UTC_FORMAT",
    "expiration_date": "DATE_IN_UTC_FORMAT"
}
  1. The process for fetching the collection metadata is the same as the one for the NFT metadata, but instead of calling the tokenURI function of the BaseRegistrar contract, you call the collectionURI function of the BaseRegistrar contract.

    • The collectionURI function returns the metadata endpoint to call for the collection.

    • You can expect the metadata to be in the format of a JSON file:

{
    "name": "Beranames",
    "owner": "Berakin Inc.",
    "description": "Official Name Service of Berachain",
    "total_supply": "to the moon",
}
  1. You can always decide to save the base URI and the collection URI in your own storage and fetch it from there, thus avoiding the need to call the tokenURI function of the BaseRegistrar contract.

    • Keep in mind that you need to calculate the tokenId from the label to fetch the correct metadata, so depending on the library you use, you might need to implement the logic to calculate the tokenId from the label.

Last updated