Opensea TokenId : Explained

Sidarth S
Coinmonks
Published in
4 min readJun 18, 2022

--

“ What is this garbage number …. Wait, is that really a garbage number ? “

Photo by Nick Hillier on Unsplash

Introduction

Have you ever tried creating NFTs in Opensea without a contract of your own and wondered what does the huge number in the Token ID actually mean …?
If Yes , Hello and Welcome to this club of clueless dummies. Let me as a fellow member of the same club, help you out with this.

What is this Humongous Number ?

Token Id : 73424079983647210902572285069973579475843508985221180214989723113099915952129

This humongous, so said junk number in Token Id , has a lot more value contained within it and gives a holistic data of the token history. The number when decoded gives the creators address , nft id, and supply (quantity) of the respective token .

TokenId Explained

The Token id , which doesn’t make sense when seen as a integer value , unpacks a lot of data when decoded as byte values. The 32 bytes of the Token id , is broken down into useful pieces of 20 bytes , 7 bytes and 5 bytes.

  • The First 20 bytes → represent the Maker’s Address
  • Next 7 bytes → represent NFT id
  • Last 5 bytes → represent the Supply or Quantity of the NFT

As all the tokens in Opensea are of ERC 1155 Standards , Quantity or Supply mentioned here , defines supply of each token that is available.

Example

Consider the NFT (CyberKong #7) , which was created directly on opensea. Lets decode its token id , using the python scripts below .

Note : Script 1 and Script 2 perform the same function, but difference can be found in their core implementation.

Script 1 (Optimal code)

  • The below script opensea_tokenId_decoded.py , takes the token id as input and peforms bit shift operations to extract respective byte values
opensea_tokenId_decoded.py : view raw source code

Script 2 (Easy Understandable Code)

  • The below script opensea_tokenId_decoded_easy.py , takes the token id as input and peforms slicing operations on the hexadecimal converted string of the Token Id.
opensea_tokenId_decoded_easy.py : view raw source code

Why this format of TokenId is useful ?

Optimized Book Keeping :

  • Maker/Creator Address specific book keeping , makes the approach neat and smooth to implement.
  • Irrespective of the collection , the NFT id keeps on incrementing as
    the user creates a new NFT .
  • Thus , each user/maker address is treated as the reference source truth for the directly created NFTs on opensea, thus making book keeping hassle free.

Ascending the NFTs to New contract :

  • Lets Suppose a collection which was initially created on opensea without any contract , becomes a huge success .
  • Now you want to add some utility over the existing NFTs, for which you need to move the NFTs listed in opensea to one of your own contract.
  • This Transition of ascending the original Opensea created NFTs into the new contract is made really simple with the use of the above token id format.
  • Popular NFT collections like CyberKong_old , which was originally created directly on opensea , have efficiently ascended the NFTs to their new contract CyberKongz , making use of this format of opensea’s token id to their at most use.
Contract : CyberKongz (0x57a204aa1042f6e66dd7730813f4024114d74f37)

Conclusion

Although at the first glance the token id format used in opensea looks like mind boggling list of large numbers, things make a lot of sense when decoded. Thus making this format of tokenId , one of the best possible way to accommodate multiple collections from multiple users under a single contract platform in an efficient decentralised way .

“ Basic walkthrough on IPO / ICO using Dutch Auction mechanism and on why its been adopted widely in the blockchain space.!! “
Check out : Dutch Auction — IPO/ICO

Creators Note

Thank you so much for reading. I hope this helps you on your web3 journey.
If any queries, feel free to reach out.
This being My First Blog on Medium , your valuable suggestions are always welcome.

Follow for more contents on Blockchain , NFTs, Defi , Smart Contracts , etc
connect with me on LinkedIn , Email.

Join Coinmonks Telegram Channel and Youtube Channel learn about crypto trading and investing

Also, Read

--

--

Sidarth S
Coinmonks

Blockchain Developer | NFTs | Smart Contract | Data Scientist | Artificial Intelligence | Deep Learning