Collection Rarity With ChatGPT in Minutes

Zachary Weiner
3 min readJul 10, 2023

--

Ordinals have become a major trend in the world of digital art, collectibles, and blockchain technology and an important concept in ordinals is ‘rarity’. In the context of ordinals, ‘rarity’ often refers to how unique or uncommon certain traits or combinations of traits are within a collection. In this post, we’ll walk through an interactive session with OpenAI’s ChatGPT, during which we ranked a collection of ordinals by their rarity.

Acquiring the Dataset

The first step was to acquire the dataset. The So I went and visited the GorillaPool API documentation and used their ‘GetCollectionItems’ endpoint to retrieve data for a specific ordinals collection. The ‘txid_vout’ field was filled with the transaction ID and output index for the transaction that created the collection. I then executed the request, copied the output JSON data, saved it to a file, and uploaded this file to ChatGPT with Code Interpreter to let it do it’s thing.

Understanding the Dataset

Once the data was presented, ChatGPT loaded the file and parsed the JSON to understand its structure. Each ordinal had a ‘MAP’ field that listed its traits, which included attributes such as ‘body’, ‘eyes’, ‘head’, ‘horn’, ‘skin’, ‘mouth’, and ‘background’.

Defining Rarity

Next, ChatGPT worked collaboratively to defined what ‘rarity’ would mean in this context. Two different definitions were considered:

  1. Trait Rarity: An inscription would be considered rare if its individual traits were uncommon within the collection.
  2. Combination Rarity: An inscription would be considered rare if the specific combination of its traits was uncommon within the collection.

Both rarity scores were then calculated for each inscription.

Calculating Rarity Scores

With the definitions of rarity agreed upon, ChatGPT proceeded to calculate the rarity scores. For the trait rarity score, the frequency of each individual trait in the dataset was calculated, and the rarity of each trait was defined as the inverse of its frequency. The trait rarity score for an inscription was then the sum of the rarities of its individual traits. For the combination rarity score, a similar process was used, but it was based on the frequency of each combination of traits in the dataset instead.

Ranking the Inscriptions

With the rarity scores calculated, the Inscriptions were then ranked. After some more discussion with the me, it was decided to focus on the trait rarity score for the final ranking. The Inscriptions were sorted by their trait rarity scores in descending order, with the most rare inscriptions at the top.

Outputting the Results

Finally, the full list of inscriptions and their trait rarity scores was outputted to a CSV file. The user could then download this file, providing a convenient way to view and share the ranked list of inscriptions.

Conclusion

This interactive session demonstrated a practical application of AI in the context of inscriptions. By leveraging Python’s data analysis capabilities and the powerful language understanding of OpenAI’s ChatGPT, a collection of inscriptions was ranked by their rarity in a collaborative and interactive manner. This approach could be used as a starting point for more sophisticated rarity analysis and ranking systems, and it highlights the potential of AI as a tool for understanding and exploring the world of inscriptions.

Author: ChatGPT
CoAuthor: Zack
https://www.twitter.com/developingzack

--

--

Zachary Weiner

Founder @MagicDapp.io & @AlphaDapp.com | Find @DevelopingZack on Twitter & Telegram