๐Ÿ…NFT Information and Rarity

You can calculate rarity and ranking for your collection or any other on chain collection. The steps as follows:

  • Retrieve NFT information and calculate trait percentage.

  • Calculate rarity score and rank based on NFT information file from previous step. We support 4 type of rarity including:

    • Trait Rarity Model

    • Mean/Average Trait Rarity Model

    • Statistical Rarity Model

    • Rarity Score Model

For more information on rarity model calculation, please visit this great blog post about NFT rarity.

Please, make sure that you are in the js/cli directory before you proceed with this step.

Create NFT Information for Your Collection

npx ts-node src/rarity-cli.ts calculate-trait -d data -c data/master.csv -m example-assets/metadata -cn soil -cd "test collection"
Param
Required
Example
Description

-d, --data <string>

true

data

Data folder that store created NFT contract information

-c, --config <string>

true

data/master.csv

MasterCSV file

-m, --metadata <string>

true

example-assets/metadata

Metadata folder

-cn, --name <string>

false

Soil

Name

-cd, --description <string>

false

"Soil Collection"

Description

-o, --output <string>

false

nfts.json

NFT information output file name

update nft information file: data/nfts.json

You will be greeted with this after its calculate collection trait successfully.

Create NFT Information for On Chain Collection

npx ts-node src/rarity-cli.ts calculate-trait-onchain -d data -c terra16ds898j530kn4nnlc7xlj6hcxzqpcxxk4mj8gkcl3vswksu6s3zszs8kp2 -n mainnet
Param
Required
Example
Description

-d, --data <string>

true

data

Data folder that store created NFT contract information

-c, --contract <string>

true

terra16ds898j530kn4nnlc7xlj6hcxzqpcxxk4mj8gkcl3vswksu6s3zszs8kp2

Contract address

-n, --network <string>

true

mainnet

Terra network. (localterra, testnet and mainnet)

-h, --height <number>

false

1000000

Block height that you want to snapshot. (Can use only mainnet)

-o, --output <string>

false

galactic.json

NFT information output file name

find total token id...
โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ 100% | ETA: 0s | 3953/3953
finding nft information...
โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ 100% | ETA: 0s | 3953/3953
update nft information file: data/terra16ds898j530kn4nnlc7xlj6hcxzqpcxxk4mj8gkcl3vswksu6s3zszs8kp2_nfts.json

You will be greeted with this after its calculate collection trait successfully.

Calculate Rarity

npx ts-node src/rarity-cli.ts calculate-rarity -d data -i data/terra16ds898j530kn4nnlc7xlj6hcxzqpcxxk4mj8gkcl3vswksu6s3zszs8kp2_nfts.json
Param
Required
Example
Description

-d, --data <string>

true

data

Data folder that store created NFT contract information

-i, --input <string>

true

data/terra16ds898j530kn4nnlc7xlj6hcxzqpcxxk4mj8gkcl3vswksu6s3zszs8kp2_nfts.json

Input NFT information file from calculate-trait/calculate-trait-onchain command.

-o, --output <string>

false

galactic_rank

Output rarity file name in csv format

calculate rarity score... 
updated collection file: data/terra16ds898j530kn4nnlc7xlj6hcxzqpcxxk4mj8gkcl3vswksu6s3zszs8kp2_nfts.json 
rank file created at: data/rank_terra16ds898j530kn4nnlc7xlj6hcxzqpcxxk4mj8gkcl3vswksu6s3zszs8kp2.csv

You will be greeted with this after its calculate collection rarity successfully.

Last updated