Build collection owners discovery
This tutorial explain the steps involved in gettting current owners of the NFT collection with the quantity of NFTs owned by each wallet address.
Step 1: Use owners endpoint to build the query
In the first step we will use a current owners endpoint that provides a snapshot of the current owners of any collection on the Ethereum blockchain.
In this tutorial we will use BAYC collection to find its owners.
As parameters in the request we will specify the contract address 0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d
and the limit 10
to get the top ten owners. If you do not specify the limit then 500 results will be returned at once.
The default order for this endpoint is descending sorted by the number of tokens owned by each address (SORT_DIRECTION_DESC
). If you want to find owners that are holding the least amount of tokens then specify &sortDirection=SORT_DIRECTION_ASC
parameter in the query.
https://ethereum-rest.api.mnemonichq.com/collections/v1beta2/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/owners_list?limit=10&sortDirection=SORT_DIRECTION_DESC
Step 2: Execute the query
For example, with cURL run the following command:
curl -i -X GET \
'https://ethereum-rest.api.mnemonichq.com/collections/v1beta2/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/owners_list?limit=10&sortDirection=SORT_DIRECTION_DESC' \
-H 'X-API-Key: YOUR_API_KEY_HERE'
import requests # requires `pip install requests`
result = requests.get(
'https://ethereum-rest.api.mnemonichq.com/collections/v1beta2/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/owners_list?limit=10&sortDirection=SORT_DIRECTION_DESC',
headers={'x-api-key': 'YOUR_API_KEY_HERE'}
).json()
Note: Make sure to obtain and specify a valid API key in the request headers.
Step 3: Analyze the result
The results should look something like this
{
"owner": [
{
"address": "0x54be3a794282c030b15e43ae2bb182e14c409c5e",
"ownedCount": "112"
},
{
"address": "0x1b523dc90a79cf5ee5d095825e586e33780f7188",
"ownedCount": "107"
},
{
"address": "0x98e711f31e49c2e50c1a290b6f2b1e493e43ea76",
"ownedCount": "73"
},
{
"address": "0xd38a87d7b690323ef6883e887614502abcf9b1eb",
"ownedCount": "72"
},
{
"address": "0x8ad272ac86c6c88683d9a60eb8ed57e6c304bb0c",
"ownedCount": "58"
},
{
"address": "0x020ca66c30bec2c4fe3861a94e4db4a498a35872",
"ownedCount": "53"
},
{
"address": "0xf606719e6e4ac5f184e702e207de3840a9c66374",
"ownedCount": "45"
},
{
"address": "0x5f6ac80cdb9e87f3cfa6a90e5140b9a16a361d5c",
"ownedCount": "39"
},
{
"address": "0x70b97a0da65c15dfb0ffa02aee6fa36e507c2762",
"ownedCount": "39"
},
{
"address": "0xf8e0c93fd48b4c34a4194d3af436b13032e641f3",
"ownedCount": "39"
}
]
}
After you completed this tutorial, let us know about your experience or if you have any feedback by tagging us on Twitter @mnemonichq or reaching out directly to our support@mnemonichq.com!