Last active
June 15, 2022 19:36
-
-
Save sidarth16/c0e03083267d16490a59f398cb5d769e to your computer and use it in GitHub Desktop.
Opensea token id format decoded.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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