Skip to content

Instantly share code, notes, and snippets.

@sidarth16
Last active June 15, 2022 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sidarth16/c0e03083267d16490a59f398cb5d769e to your computer and use it in GitHub Desktop.
Save sidarth16/c0e03083267d16490a59f398cb5d769e to your computer and use it in GitHub Desktop.
Opensea token id format decoded.
# Token Id (as given in Opensea)
id = 73424079983647210902572285069973579475843508985221180214989722260978404425729
print("Id \t : ",id)
# Convert Id to Hexadecimal
str_id = str(hex(id))
print("Hex(id) : ", str_id)
str_id = str_id[2:] # Removing 0x from Hex String stored
'''
Each byte of plaintext is represented by 2 Hexa decimal
( 1 byte = 2 Hexa digits )
'''
# First 20 bytes represent maker address
maker = str_id [0 : 40] # 20 bytes => 40 hexa digits
print("Maker \t : ", hex(int(maker, 16)) )
# Next 7 bytes represent nft ID
nft_id = str_id [40 : 40+14] # 7 bytes => 14 hexa digits
print("NFT id \t : ", int(nft_id, 16))
# Last 5 bytes represent Quantity / Supply of this Id
qty = str_id [-10 : ] # 5 bytes => 10 hexa digits
print("Quantity : ", int(qty, 16))
#---OUTPUT---#
# Id : 73424079983647210902572285069973579475843508985221180214989722260978404425729
# Hex(id) : 0xa2548e7ad6cee01eeb19d49bedb359aea3d8ad1d000000000000070000000001
# Maker : 0xa2548e7ad6cee01eeb19d49bedb359aea3d8ad1d
# NFT id : 7
# Quantity : 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment