Hey everyone,
I’m trying to figure out how to get info on who owned a Solana NFT at a specific time in the past. I know it’s pretty easy to find out who owns an NFT right now, but I’m stumped on how to get historical ownership data.
I thought maybe I could pull all the transfer transactions for the NFT and then sort the ‘from’ addresses by time. But that seems kind of clunky. Does anyone know a better way to do this?
Here’s a quick example of what I’m trying to do:
def get_nft_owner_at_timestamp(nft_address, timestamp):
# Somehow get historical ownership data
# Return the owner address at the given timestamp
pass
nft_address = 'ABC123'
past_timestamp = 1634567890
past_owner = get_nft_owner_at_timestamp(nft_address, past_timestamp)
print(f'The owner at {past_timestamp} was: {past_owner}')
Any ideas or tips would be super helpful. Thanks!
hey there zoe! this is a really cool question. i’m kinda new to solana but super interested in nft stuff. have you thought about using the solana explorer api? maybe it has some hidden gems for historical data? 
also, i’m curious - what’s the use case for this? are you building something awesome with historical nft ownership? it sounds like it could be really interesting!
btw, your python example looks neat. have you tried running it with any real data yet? i’d love to hear how it goes if you make progress on this. maybe we could brainstorm some more ideas together?
I’ve encountered this challenge before. Unfortunately, Solana doesn’t provide native support for historical state queries like Ethereum does. Your approach of analyzing transfer transactions is indeed a viable method, albeit somewhat inefficient.
One potential optimization is to leverage the Solana block explorer API to fetch transaction history for the NFT’s mint address. This can be more efficient than querying all transfers. You’d still need to process the transactions chronologically to determine ownership at a specific timestamp.
Another consideration is caching results if you’re querying the same NFT multiple times. This can significantly reduce API calls and processing time for subsequent queries.
Lastly, some third-party indexing services are emerging that aim to provide historical data for Solana. While not perfect, they might offer a more streamlined solution for your use case.
hey zoe, i’ve been dealing with this too. solana doesn’t support historical snapshots like ethereum. so yeah, pulling transfer txs from a block explorer api and sorting them might be the only way. not perfect but should give you a ballpark.