Do you have a really old NFT collection on OpenSea from back when they had the Shared Storefront contract and you want to take a snapshot of the holders of your tokens?
This app is for you!
The Shared Storefront minted all NFT collections on the same contract, so in order to generate a snapshot of all holders in your collection, you have to find your collection's first token id and its last token id.
For example, take this DOS Phunks collection by my friend @sasha_nft.
It's a collection of 500 images on the OpenSea Shared Storefront contract.
From the URL, we see the contract address is 0x495f947276749ce646f68ac8c248420045cb7b5e
(we knew that!)
but its token is 95275418173482098644567937320619260930605140094311403563734332850068399325185
.
Let's take a look at DOS Phunk 2's token. It's 95275418173482098644567937320619260930605140094311403563734332851167910952961
.
Okay, so right away, we can compare the first two ids and see that these aren't randomly generated.
Let's take a closer look in IRB, Ruby's default REPL.
phunk2 = 95275418173482098644567937320619260930605140094311403563734332851167910952961
=> 95275418173482098644567937320619260930605140094311403563734332851167910952961
phunk1 = 95275418173482098644567937320619260930605140094311403563734332850068399325185
=> 95275418173482098644567937320619260930605140094311403563734332850068399325185
phunk2 - phunk1
=> 1099511627776
Those are two huge numbers that are not very far apart, relatively. Let's check out the third Phunk and see if these are encoded data including timestamps or what.
DOS Phunk 3's id is 95275418173482098644567937320619260930605140094311403563734332852267422580737
.
Let's fire up IRB again!
phunk3 = 95275418173482098644567937320619260930605140094311403563734332852267422580737
=> 95275418173482098644567937320619260930605140094311403563734332852267422580737
phunk3 - phunk2
=> 1099511627776
1099511627776
again! It appears to be a linear id progression. We could check DOS Phunk 4, but just trust me.
That is a large decimal number, which is pretty strange. I wonder if it could be some other representation of data, just converted to decimal?
This is how you convert a decimal to hex in Ruby.
1099511627776.to_s(16)
=> "10000000000"
Let's check the hex values of the first 3 Phunks.
phunk1.to_s(16)
=> "d2a3f9c6fbe4c13d979898e603d64561264a6b35000000000000a60000000001"
phunk2.to_s(16)
=> "d2a3f9c6fbe4c13d979898e603d64561264a6b35000000000000a70000000001"
phunk3.to_s(16)
=> "d2a3f9c6fbe4c13d979898e603d64561264a6b35000000000000a80000000001"
Okay, now that's starting to make more sense.
From the URL, we see the token is 95275418173482098644567937320619260930605140094311403563734333399824213213185
.
Now, that we know each id is incremented 1099511627776
(in decimal), we can generate the ids for every Phunk
in the collection with just the first token id and the last token id.
Here's how simple that is in Ruby:
(first_token_id..last_token_id).step(1099511627776).to_a
first_token_id = phunk1
=> 95275418173482098644567937320619260930605140094311403563734332850068399325185
last_token_id = phunk500
=> 95275418173482098644567937320619260930605140094311403563734333399824213213185
(first_token_id..last_token_id).step(1099511627776).to_a
=>
[95275418173482098644567937320619260930605140094311403563734332850068399325185,
95275418173482098644567937320619260930605140094311403563734332851167910952961,
95275418173482098644567937320619260930605140094311403563734332852267422580737,
95275418173482098644567937320619260930605140094311403563734332853366934208513,
95275418173482098644567937320619260930605140094311403563734332854466445836289,
95275418173482098644567937320619260930605140094311403563734332855565957464065,
# ...
95275418173482098644567937320619260930605140094311403563734333393227143446529,
95275418173482098644567937320619260930605140094311403563734333394326655074305,
95275418173482098644567937320619260930605140094311403563734333395426166702081,
95275418173482098644567937320619260930605140094311403563734333396525678329857,
95275418173482098644567937320619260930605140094311403563734333397625189957633,
95275418173482098644567937320619260930605140094311403563734333398724701585409,
95275418173482098644567937320619260930605140094311403563734333399824213213185]
Let's spot check. Does this link take you to Phunk 5? And does this one take you to Phunk 498?
- @rhizanthemum on Twitter
- @rhiza on Warpcast
- chunky metro discord