Sitemap

Rarity 101 — Metadata and Rarity Calculation

3 min readDec 5, 2021

--

What is metadata and where does it live on the blockchain? What is an NFT’s rarity and how is it calculated?

What is metadata, and how can we view it?

Before discussing rarity, it’s important to know what metadata is. Each ERC721 token (aka an NFT) has some sort of data attached to it on the blockchain. Usually, this data is just an ordinary URL that points to the important stuff. For example, we can look at Bored Ape Yacht Club #753’s metadata here. It has the NFT’s image and attributes, which correspond to the way it looks. Most NFT’s will (and should) follow this format of an image and a list of traits. Some NFT’s store this information directly on the blockchain instead of pointing to an external URL. Pretty cool!

Next, we’d like to know how to find this metadata. First, you’ll want to navigate to the contract on etherscan. One way to get here is to navigate to your desired NFT on Opensea, scroll down to the “Details” pane, and you’ll see “Contract Address”. Alternatively, you can just navigate to “etherscan.io/address/CONTRACT_ADDRESS”.

Now that we’re on Etherscan, press the “Contract” tab, then press “Read Contract”.

We can scroll down to the “TokenURI” and enter in any token ID that we are interested in, then hit Query.

This metadata is stored on IPFS which makes it more decentralized than some other options. You’ll need to do one more extra step here and replace “ipfs://” with “ipfs.io/ipfs/” before searching up the URL. In this case, “https://ipfs.io/ipfs/QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/753" lets us easily access the data.

How can we calculate rarity for a given NFT collection?

We’ve just found the metadata for a single NFT token, next let us assume we have easy access to the traits of all 10,000 NFTs of the Bored Apes. Rarity has a good write-up on the different types of rarity calculations, so I will link it here.

On LooksRare you will see that each trait has a ‘score’ next to it, where a higher score indicates a more rare trait. Each trait score is calculated by dividing 1 by the probability of that trait occurring. For example, if a trait only occurs 10 times, its trait score would be (1 / (10 / 10,000)) = 1,000.

Repeat this process for each trait in a given NFT (such as Bored Ape #723), then the sum of each trait score gives the NFT’s total rarity score. Finally, we can sort the score of each NFT within a collection and rank them.

--

--

LooksRare
LooksRare

Written by LooksRare

Rarity Tool for the ethereum blockchain

No responses yet