Getting information about all NFTs of an user

Getting information about all NFTs of an user

using BitClout API

·

7 min read

Just in case you don't know, BitClout now has released the feature to mint NFTs on the platform. What makes CLOUT (the native crypto currence of BitClout) NFTs unique is tons of other features attached with NFTs. On BitClout, an NFT artist can get revenue from re-sales of his work through creator royalty and at the same time an NFT artist can attract investors by giving some proportion of the sale to the investors as coin holder royalty. But anyways, this article isn't about explaining the CLOUT NFTs but about how you can get information about all the NFTs the user has purchased or has created.

Before you read more, make sure you understand the basics of python and have an understand of the API structure of BitClout ( you can read other blogs on DevsClout for better understanding )

Diving into the code

The API endpoint to get information about user NFTs is api/v0/get-nfts-for-user Here is a simple python code that get's the information about all the NFTs a user has


import json
import requests



def get_nft_for_user(publicKey, isForSale): #isForSale can be True or None if you want all the NFTs 
    payload = {"UserPublicKeyBase58Check":publicKey,"ReaderPublicKeyBase58Check":"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg","IsForSale":isForSale}
    response = requests.post("https://bitclout.com/api/v0/get-nfts-for-user", json = payload)
    with open("NFT_info_for_user.json", "w") as file:
        if response.status_code == 200:
            json.dump(response.json(), file)

    return response.status_code

if __name__ == "__main__":

    #passing the public key the user for which we want to get NFTs
    print(get_nft_for_user("BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg", None))

On execution, if the code prints status code 200, you will see a new JSON file created which has all information about the NFTs the user has.

The data returned is something like this:

{
    "NFTsMap": {
        "559741bed7d07b6a0fd81625f2b0deb0eb684c0d4cc71305df8e1278f4149685": {
            "PostEntryResponse": {
                "PostHashHex": "559741bed7d07b6a0fd81625f2b0deb0eb684c0d4cc71305df8e1278f4149685",
                "PosterPublicKeyBase58Check": "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg",
                "ParentStakeID": "",
                "Body": "I made this night illustration when I was learning Inkscape :D\n\nCan we get a reclout ? (I still haven't got any reclout yet )",
                "ImageURLs": [
                    "https://i.imgur.com/tEOdi0w.jpg"
                ],
                "RecloutedPostEntryResponse": null,
                "CreatorBasisPoints": 0,
                "StakeMultipleBasisPoints": 12500,
                "TimestampNanos": 1617960627692647625,
                "IsHidden": false,
                "ConfirmationBlockHeight": 13917,
                "InMempool": false,
                "StakeEntry": {
                    "TotalPostStake": 0,
                    "StakeList": []
                },
                "StakeEntryStats": {
                    "TotalStakeNanos": 0,
                    "TotalStakeOwedNanos": 0,
                    "TotalCreatorEarningsNanos": 0,
                    "TotalFeesBurnedNanos": 0,
                    "TotalPostStakeNanos": 0
                },
                "ProfileEntryResponse": {
                    "PublicKeyBase58Check": "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg",
                    "Username": "ItsAditya",
                    "Description": "17 y/o programmer \ud83d\udc68\u200d\ud83d\udcbb\n\nData Enthusiast.\n\nFollow me for stats about BitClout, development updates, arts and memes!\n\nBlogs @DevsClout",
                    "IsHidden": false,
                    "IsReserved": false,
                    "IsVerified": true,
                    "Comments": null,
                    "Posts": null,
                    "CoinEntry": {
                        "CreatorBasisPoints": 1100,
                        "BitCloutLockedNanos": 90998113089,
                        "NumberOfHolders": 513,
                        "CoinsInCirculationNanos": 44897994623,
                        "CoinWatermarkNanos": 45495581984
                    },
                    "CoinPriceBitCloutNanos": 6080324274,
                    "StakeMultipleBasisPoints": 12500,
                    "StakeEntryStats": {
                        "TotalStakeNanos": 0,
                        "TotalStakeOwedNanos": 0,
                        "TotalCreatorEarningsNanos": 0,
                        "TotalFeesBurnedNanos": 0,
                        "TotalPostStakeNanos": 0
                    },
                    "UsersThatHODL": null
                },
                "Comments": null,
                "LikeCount": 38,
                "DiamondCount": 13,
                "PostEntryReaderState": null,
                "InGlobalFeed": false,
                "IsPinned": false,
                "PostExtraData": {},
                "CommentCount": 24,
                "RecloutCount": 32,
                "QuoteRecloutCount": 3,
                "ParentPosts": null,
                "IsNFT": true,
                "NumNFTCopies": 1,
                "NumNFTCopiesForSale": 0,
                "HasUnlockable": false,
                "NFTRoyaltyToCreatorBasisPoints": 1000,
                "NFTRoyaltyToCoinBasisPoints": 1000,
                "DiamondsFromSender": 0
            },
            "NFTEntryResponses": [
                {
                    "OwnerPublicKeyBase58Check": "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg",
                    "SerialNumber": 1,
                    "IsForSale": false,
                    "MinBidAmountNanos": 500000000,
                    "LastAcceptedBidAmountNanos": 0,
                    "HighestBidAmountNanos": 0,
                    "LowestBidAmountNanos": 0
                }
            ]
        },
        "b23763c43be23d1701caad16c83df3730a615490ea72895843085480d85667b1": {
            "PostEntryResponse": {
                "PostHashHex": "b23763c43be23d1701caad16c83df3730a615490ea72895843085480d85667b1",
                "PosterPublicKeyBase58Check": "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg",
                "ParentStakeID": "",
                "Body": "Here are top 20 users who have received most diamonds from @DiamondHands \n\n\ud83e\udd47 @Krassenstein \n\ud83e\udd48 @balajis \n\ud83e\udd49 @renatavc \n\nGlad to see myself at #11 and @tijn at #12 \ud83d\ude05\n\nGuess what DH has never given 6 tier diamonds yet \ud83d\udc40 ",
                "ImageURLs": [
                    "https://images.bitclout.com/d1995468ca1b073e564a17a62de36e8405d97160592c179105a281aee066548e.webp"
                ],
                "RecloutedPostEntryResponse": null,
                "CreatorBasisPoints": 1000,
                "StakeMultipleBasisPoints": 12500,
                "TimestampNanos": 1626190102602075826,
                "IsHidden": false,
                "ConfirmationBlockHeight": 42247,
                "InMempool": false,
                "StakeEntry": {
                    "TotalPostStake": 0,
                    "StakeList": []
                },
                "StakeEntryStats": {
                    "TotalStakeNanos": 0,
                    "TotalStakeOwedNanos": 0,
                    "TotalCreatorEarningsNanos": 0,
                    "TotalFeesBurnedNanos": 0,
                    "TotalPostStakeNanos": 0
                },
                "ProfileEntryResponse": {
                    "PublicKeyBase58Check": "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg",
                    "Username": "ItsAditya",
                    "Description": "17 y/o programmer \ud83d\udc68\u200d\ud83d\udcbb\n\nData Enthusiast.\n\nFollow me for stats about BitClout, development updates, arts and memes!\n\nBlogs @DevsClout",
                    "IsHidden": false,
                    "IsReserved": false,
                    "IsVerified": true,
                    "Comments": null,
                    "Posts": null,
                    "CoinEntry": {
                        "CreatorBasisPoints": 1100,
                        "BitCloutLockedNanos": 90998113089,
                        "NumberOfHolders": 513,
                        "CoinsInCirculationNanos": 44897994623,
                        "CoinWatermarkNanos": 45495581984
                    },
                    "CoinPriceBitCloutNanos": 6080324274,
                    "StakeMultipleBasisPoints": 12500,
                    "StakeEntryStats": {
                        "TotalStakeNanos": 0,
                        "TotalStakeOwedNanos": 0,
                        "TotalCreatorEarningsNanos": 0,
                        "TotalFeesBurnedNanos": 0,
                        "TotalPostStakeNanos": 0
                    },
                    "UsersThatHODL": null
                },
                "Comments": null,
                "LikeCount": 29,
                "DiamondCount": 12,
                "PostEntryReaderState": null,
                "InGlobalFeed": true,
                "IsPinned": false,
                "PostExtraData": {},
                "CommentCount": 19,
                "RecloutCount": 3,
                "QuoteRecloutCount": 3,
                "ParentPosts": null,
                "IsNFT": true,
                "NumNFTCopies": 1,
                "NumNFTCopiesForSale": 0,
                "HasUnlockable": false,
                "NFTRoyaltyToCreatorBasisPoints": 1000,
                "NFTRoyaltyToCoinBasisPoints": 1000,
                "DiamondsFromSender": 0
            },
            "NFTEntryResponses": [
                {
                    "OwnerPublicKeyBase58Check": "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg",
                    "SerialNumber": 1,
                    "IsForSale": false,
                    "MinBidAmountNanos": 0,
                    "LastAcceptedBidAmountNanos": 0,
                    "HighestBidAmountNanos": 0,
                    "LowestBidAmountNanos": 0
                }
            ]
        },
        "bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177": {
            "PostEntryResponse": {
                "PostHashHex": "bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177",
                "PosterPublicKeyBase58Check": "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg",
                "ParentStakeID": "",
                "Body": "Just setting up my BitClout",
                "ImageURLs": [],
                "RecloutedPostEntryResponse": null,
                "CreatorBasisPoints": 0,
                "StakeMultipleBasisPoints": 12500,
                "TimestampNanos": 1617644791507159060,
                "IsHidden": false,
                "ConfirmationBlockHeight": 12868,
                "InMempool": false,
                "StakeEntry": {
                    "TotalPostStake": 0,
                    "StakeList": []
                },
                "StakeEntryStats": {
                    "TotalStakeNanos": 0,
                    "TotalStakeOwedNanos": 0,
                    "TotalCreatorEarningsNanos": 0,
                    "TotalFeesBurnedNanos": 0,
                    "TotalPostStakeNanos": 0
                },
                "ProfileEntryResponse": {
                    "PublicKeyBase58Check": "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg",
                    "Username": "ItsAditya",
                    "Description": "17 y/o programmer \ud83d\udc68\u200d\ud83d\udcbb\n\nData Enthusiast.\n\nFollow me for stats about BitClout, development updates, arts and memes!\n\nBlogs @DevsClout",
                    "IsHidden": false,
                    "IsReserved": false,
                    "IsVerified": true,
                    "Comments": null,
                    "Posts": null,
                    "CoinEntry": {
                        "CreatorBasisPoints": 1100,
                        "BitCloutLockedNanos": 90998113089,
                        "NumberOfHolders": 513,
                        "CoinsInCirculationNanos": 44897994623,
                        "CoinWatermarkNanos": 45495581984
                    },
                    "CoinPriceBitCloutNanos": 6080324274,
                    "StakeMultipleBasisPoints": 12500,
                    "StakeEntryStats": {
                        "TotalStakeNanos": 0,
                        "TotalStakeOwedNanos": 0,
                        "TotalCreatorEarningsNanos": 0,
                        "TotalFeesBurnedNanos": 0,
                        "TotalPostStakeNanos": 0
                    },
                    "UsersThatHODL": null
                },
                "Comments": null,
                "LikeCount": 1,
                "DiamondCount": 7,
                "PostEntryReaderState": null,
                "InGlobalFeed": false,
                "IsPinned": false,
                "PostExtraData": {},
                "CommentCount": 0,
                "RecloutCount": 0,
                "QuoteRecloutCount": 1,
                "ParentPosts": null,
                "IsNFT": true,
                "NumNFTCopies": 1,
                "NumNFTCopiesForSale": 1,
                "HasUnlockable": true,
                "NFTRoyaltyToCreatorBasisPoints": 1500,
                "NFTRoyaltyToCoinBasisPoints": 500,
                "DiamondsFromSender": 0
            },
            "NFTEntryResponses": [
                {
                    "OwnerPublicKeyBase58Check": "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg",
                    "SerialNumber": 1,
                    "IsForSale": true,
                    "MinBidAmountNanos": 1000000000,
                    "LastAcceptedBidAmountNanos": 0,
                    "HighestBidAmountNanos": 0,
                    "LowestBidAmountNanos": 0
                }
            ]
        },
        "d0fdeb0955ec1884682e323af93cab44d81d4c0f72b8ac1da3bf35efd76375f5": {
            "PostEntryResponse": {
                "PostHashHex": "d0fdeb0955ec1884682e323af93cab44d81d4c0f72b8ac1da3bf35efd76375f5",
                "PosterPublicKeyBase58Check": "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg",
                "ParentStakeID": "",
                "Body": "Made this moon illustration \u2728\n\nWe are going just beyond it! \ud83d\ude80",
                "ImageURLs": [
                    "https://i.imgur.com/7iEbVPi.png"
                ],
                "RecloutedPostEntryResponse": null,
                "CreatorBasisPoints": 0,
                "StakeMultipleBasisPoints": 12500,
                "TimestampNanos": 1618377082580271282,
                "IsHidden": false,
                "ConfirmationBlockHeight": 15253,
                "InMempool": false,
                "StakeEntry": {
                    "TotalPostStake": 0,
                    "StakeList": []
                },
                "StakeEntryStats": {
                    "TotalStakeNanos": 0,
                    "TotalStakeOwedNanos": 0,
                    "TotalCreatorEarningsNanos": 0,
                    "TotalFeesBurnedNanos": 0,
                    "TotalPostStakeNanos": 0
                },
                "ProfileEntryResponse": {
                    "PublicKeyBase58Check": "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg",
                    "Username": "ItsAditya",
                    "Description": "17 y/o programmer \ud83d\udc68\u200d\ud83d\udcbb\n\nData Enthusiast.\n\nFollow me for stats about BitClout, development updates, arts and memes!\n\nBlogs @DevsClout",
                    "IsHidden": false,
                    "IsReserved": false,
                    "IsVerified": true,
                    "Comments": null,
                    "Posts": null,
                    "CoinEntry": {
                        "CreatorBasisPoints": 1100,
                        "BitCloutLockedNanos": 90998113089,
                        "NumberOfHolders": 513,
                        "CoinsInCirculationNanos": 44897994623,
                        "CoinWatermarkNanos": 45495581984
                    },
                    "CoinPriceBitCloutNanos": 6080324274,
                    "StakeMultipleBasisPoints": 12500,
                    "StakeEntryStats": {
                        "TotalStakeNanos": 0,
                        "TotalStakeOwedNanos": 0,
                        "TotalCreatorEarningsNanos": 0,
                        "TotalFeesBurnedNanos": 0,
                        "TotalPostStakeNanos": 0
                    },
                    "UsersThatHODL": null
                },
                "Comments": null,
                "LikeCount": 6,
                "DiamondCount": 10,
                "PostEntryReaderState": null,
                "InGlobalFeed": false,
                "IsPinned": false,
                "PostExtraData": {},
                "CommentCount": 1,
                "RecloutCount": 2,
                "QuoteRecloutCount": 0,
                "ParentPosts": null,
                "IsNFT": true,
                "NumNFTCopies": 1,
                "NumNFTCopiesForSale": 0,
                "HasUnlockable": false,
                "NFTRoyaltyToCreatorBasisPoints": 1000,
                "NFTRoyaltyToCoinBasisPoints": 1000,
                "DiamondsFromSender": 0
            },
            "NFTEntryResponses": [
                {
                    "OwnerPublicKeyBase58Check": "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg",
                    "SerialNumber": 1,
                    "IsForSale": false,
                    "MinBidAmountNanos": 500000000,
                    "LastAcceptedBidAmountNanos": 0,
                    "HighestBidAmountNanos": 0,
                    "LowestBidAmountNanos": 0
                }
            ]
        },
        "d8b41470ce31cb0778fdc102abcf0743efa5b16f66843f63839b4ab963433dd5": {
            "PostEntryResponse": {
                "PostHashHex": "d8b41470ce31cb0778fdc102abcf0743efa5b16f66843f63839b4ab963433dd5",
                "PosterPublicKeyBase58Check": "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg",
                "ParentStakeID": "",
                "Body": "Here is my first ever NFT minted on BitClout.\n\nIt's a 5100px x 5100px image containing profile images of top 2,601 active users of BitClout\n\nEach image has a unique QR code that stores the username of that profile pic.\n",
                "ImageURLs": [
                    "https://yz7ffl6cwoaxkdstdxvuo7avcuqudq5w4i47m32bjmoy7xbpcysa.arweave.net/xn5Sr8KzgXUOUx3rR3wVFSFBw7biOfZvQUsdj9wvFiQ"
                ],
                "RecloutedPostEntryResponse": null,
                "CreatorBasisPoints": 1000,
                "StakeMultipleBasisPoints": 12500,
                "TimestampNanos": 1627497504721280693,
                "IsHidden": false,
                "ConfirmationBlockHeight": 46653,
                "InMempool": false,
                "StakeEntry": {
                    "TotalPostStake": 0,
                    "StakeList": []
                },
                "StakeEntryStats": {
                    "TotalStakeNanos": 0,
                    "TotalStakeOwedNanos": 0,
                    "TotalCreatorEarningsNanos": 0,
                    "TotalFeesBurnedNanos": 0,
                    "TotalPostStakeNanos": 0
                },
                "ProfileEntryResponse": {
                    "PublicKeyBase58Check": "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg",
                    "Username": "ItsAditya",
                    "Description": "17 y/o programmer \ud83d\udc68\u200d\ud83d\udcbb\n\nData Enthusiast.\n\nFollow me for stats about BitClout, development updates, arts and memes!\n\nBlogs @DevsClout",
                    "IsHidden": false,
                    "IsReserved": false,
                    "IsVerified": true,
                    "Comments": null,
                    "Posts": null,
                    "CoinEntry": {
                        "CreatorBasisPoints": 1100,
                        "BitCloutLockedNanos": 90998113089,
                        "NumberOfHolders": 513,
                        "CoinsInCirculationNanos": 44897994623,
                        "CoinWatermarkNanos": 45495581984
                    },
                    "CoinPriceBitCloutNanos": 6080324274,
                    "StakeMultipleBasisPoints": 12500,
                    "StakeEntryStats": {
                        "TotalStakeNanos": 0,
                        "TotalStakeOwedNanos": 0,
                        "TotalCreatorEarningsNanos": 0,
                        "TotalFeesBurnedNanos": 0,
                        "TotalPostStakeNanos": 0
                    },
                    "UsersThatHODL": null
                },
                "Comments": null,
                "LikeCount": 42,
                "DiamondCount": 17,
                "PostEntryReaderState": null,
                "InGlobalFeed": false,
                "IsPinned": false,
                "PostExtraData": {},
                "CommentCount": 29,
                "RecloutCount": 10,
                "QuoteRecloutCount": 16,
                "ParentPosts": null,
                "IsNFT": true,
                "NumNFTCopies": 1,
                "NumNFTCopiesForSale": 0,
                "HasUnlockable": false,
                "NFTRoyaltyToCreatorBasisPoints": 1000,
                "NFTRoyaltyToCoinBasisPoints": 1000,
                "DiamondsFromSender": 0
            },
            "NFTEntryResponses": [
                {
                    "OwnerPublicKeyBase58Check": "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg",
                    "SerialNumber": 1,
                    "IsForSale": true,
                    "MinBidAmountNanos": 2000000000,
                    "LastAcceptedBidAmountNanos": 0,
                    "HighestBidAmountNanos": 0,
                    "LowestBidAmountNanos": 0
                }
            ]
        }
    }
}

The endpoint is useful in various ways as it returns the unique hash of all the NFTs, PostHashHex, IsForSale in NFTEntryResponses, SerialNumber, MinBidAmountNanos ( divide this value by 10^9 to get price in $CLOUT ) and many other matrices like HighestBidAmountNanos, LowestBidAmountNanos, NumNFTCopiesForSale etc. Explore the data yourself to get a better understanding of it!

If you like the article don't forget to let us know in the comments or maybe give a shout to DevsClout ? You can also join DevsClout discord server to chat with more devs who are building awesome projects on BitClout! We would love to hear back from you