Learn
Michael Calvey
June 7, 2022

Simple NFT Gini Analysis

This post shows how easy it is to pull bulk data on an NFT collection, query ENS names and run some simple analysis to calculate the Gini Coefficient of holders using the Transpose Python SDK.

In this post we explore how simple it is to retrieve and analyze detailed NFT and ENS data with the Transpose Python SDK. Our goal today is to analyze the ownership of Bored Ape Yacht Club NFTs, calculate the Gini Coefficient and retrieve ENS names for top holders. We can do all this with just a few simple calls to our API.

As always, all of the code is available to test yourself in our public git repo.

Here’s the output we’re expecting:

The Gini Coefficient: captures the equality of token ownership. 0 is perfectly equal (each owner owns just one Bored Ape) while 1 is perfectly unequal (one owner owns all NFTs). For context, the Gini of household incomes in the US is .48 - so Bored Ape ownership is more equally distributed than US household income.

Setting Up

We first import packages we’re going to use and set key variables. All you really need here is Transpose, an API key (available at https://transpose.io) and a contract address.

Retrieve data

Here we use the simple paging functionality in the Transpose SDK to quickly collect all Bored Ape owners, 500 at a time.

Aggregate Owners

Next, let’s tally how many NFTs each owner owns.

Data Output

Let’s display the information we have. We first try to retrieve assigned primary ENS names for top holder addresses, then display the count. We use a Gini calculation helper function included in the SDK demo/lib folder to calculate gini.

Summary

In this post, we’ve learned how to use the Transpose API to query ownership data for all tokens in the original Bored Ape collection and pull primary ENS records for account addresses. This is just the start of what’s possible with the Transpose API — we’ll cover lots more exciting use cases in future blog posts.

The complete project file from this post is available in the SDK demo files.

Stay on the lookout for more informative content here and on our Twitter.

Return