There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

Exploration of Sui Data Application Scenarios

Introduction

Sui introduces a unique approach where all contracts, NFTs (Non-Fungible Tokens), and Coins can be perceived as Objects. This innovative storage structure operates on the basis of Objects, forming the foundation of Sui’s functionalities. In this article, we will explore the three core aspects related to Objects in Sui: NFT Collections, Token Values, and Package Contracts. Discover how Sui’s Object-based system revolutionizes the blockchain landscape.

  1. NFT (Collection)

NFTs are unique digital assets that represent ownership of a specific item, artwork, or collectible on the blockchain. In Sui, NFTs are treated as Objects, and their control is governed by a specific contract package. To find the NFT control contract package, we need to identify the package responsible for the minting functionality of the NFTs.

How to Find the NFT Control Contract Package?

To locate the NFT control contract package, we first need to find the package ID (object ID) associated with the NFT. For example, let’s say we want to find the bulk shark NFT package ID with the object ID

To locate the NFT control contract package, we first need to find the package ID (object ID) associated with the NFT. For example, let’s say we want to find the bulk shark NFT package ID with the object ID

0xee496a0cc04d06a345982ba6697c90c619020de9e274408c7819f787ff66e1a1.

Querying All Move_Calls (Transactions) in the Package

Once we have the package ID, we can query all the move_calls (transactions) generated within that package:


<span style="font-weight:bold;color:#a71d5d;">select * from 
</span><span style="color:#0086b3;">sui</span><span style="color:#323232;">.</span><span style="color:#0086b3;">move_calls 
</span><span style="font-weight:bold;color:#a71d5d;">where</span><span style="color:#323232;"> move_package </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#183691;">'0xee496a0cc04d06a345982ba6697c90c619020de9e274408c7819f787ff66e1a1'</span><span style="color:#323232;">;
</span><span style="color:#323232;">
</span>

Finding All NFT Objects in the Package

Alternatively, we can find all the NFT objects within the package using the corresponding NFT object type:


<span style="font-weight:bold;color:#a71d5d;">select * from 
</span><span style="color:#0086b3;">sui</span><span style="color:#323232;">.</span><span style="color:#0086b3;">objects
</span><span style="font-weight:bold;color:#a71d5d;">where</span><span style="color:#323232;"> object_type </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#183691;">'0xee496a0cc04d06a345982ba6697c90c619020de9e274408c7819f787ff66e1a1::suifrens::SuiFren&lt;0x8894fa02fc6f36cbc485ae9145d05f247a78e220814fb8419ab261bd81f08f32::bullshark::Bullshark>'</span><span style="color:#323232;">;
</span><span style="color:#323232;">
</span>
  1. Token Value

Sui’s Coins are also treated as Objects, and each CoinType generates a unique Object ID. As a result, calculating balances requires grouping the same CoinType and Account Address.

How to Query Token Balances?

To query token balances, we need to group the same CoinType and Account Address together and calculate their total balance. For instance, the following SQL query retrieves the top 100 balances for the Sui Coin (CoinType: 0x2::coin::Coin<0x2::sui::SUI>):


<span style="font-weight:bold;color:#a71d5d;">select </span><span style="color:#62a35c;">sum</span><span style="color:#323232;">(storage_rebate) </span><span style="font-weight:bold;color:#a71d5d;">as</span><span style="color:#323232;"> balance, owner_address 
</span><span style="font-weight:bold;color:#a71d5d;">from 
</span><span style="color:#0086b3;">sui</span><span style="color:#323232;">.</span><span style="color:#0086b3;">objects 
</span><span style="font-weight:bold;color:#a71d5d;">where</span><span style="color:#323232;"> object_type </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#183691;">'0x2::coin::Coin&lt;0x2::sui::SUI>' 
</span><span style="font-weight:bold;color:#a71d5d;">group by</span><span style="color:#323232;"> owner_address, storage_rebate 
</span><span style="font-weight:bold;color:#a71d5d;">order by</span><span style="color:#323232;"> balance </span><span style="font-weight:bold;color:#a71d5d;">desc 
</span><span style="font-weight:bold;color:#a71d5d;">limit </span><span style="color:#0086b3;">100</span><span style="color:#323232;">;
</span><span style="color:#323232;">
</span>
  1. Package (Contract)

Top Contracts are determined by grouping packages based on the number of interactions they have.

How to Find Top Contracts?

To identify the top contracts, we group the packages by the number of move_calls (transactions) they generate. The following SQL query provides information on the top 100 contracts:


<span style="font-weight:bold;color:#a71d5d;">select </span><span style="color:#62a35c;">count</span><span style="color:#323232;">(</span><span style="color:#0086b3;">1</span><span style="color:#323232;">) </span><span style="font-weight:bold;color:#a71d5d;">as</span><span style="color:#323232;"> score, move_package 
</span><span style="font-weight:bold;color:#a71d5d;">from 
</span><span style="color:#0086b3;">sui</span><span style="color:#323232;">.</span><span style="color:#0086b3;">move_calls 
</span><span style="font-weight:bold;color:#a71d5d;">group by</span><span style="color:#323232;"> move_package 
</span><span style="font-weight:bold;color:#a71d5d;">order by</span><span style="color:#323232;"> score 
</span><span style="font-weight:bold;color:#a71d5d;">desc 
</span><span style="font-weight:bold;color:#a71d5d;">limit </span><span style="color:#0086b3;">100</span><span style="color:#323232;">;
</span><span style="color:#323232;">
</span>

FAQs

Q 1: What are Objects in Sui?

Objects in Sui refer to a unique approach where all contracts, NFTs, and Coins are considered as individual Objects. This Object-based storage structure forms the core of Sui’s operations.

Q 2: How do I find the control contract package for NFTs?

To locate the control contract package for NFTs, you need to identify the specific NFT type, and the package ID can be found as the first hexadecimal prefix in the NFT type. For instance, if the NFT object’s type is 0x5325…17a2, and it belongs to the type 0xee49…e1a1::suifrens::SuiFren<0x8894…8f32::bullshark::Bullshark>, then the collection’s package ID would be 0xee49…e1a1.

Q 3: Can I query token balances for specific Coins in Sui?

Yes, you can query token balances for specific Coins in Sui. By grouping the same CoinType and Account Address, you can calculate the total balance for each toke

Q 4: What makes Sui’s Object-based storage system unique?

Sui’s Object-based storage system is unique as it treats all contracts, NFTs, and Coins as Objects. This innovative approach streamlines the storage structure and enhances overall blockchain functionalities.

Q 5: Are all NFTs stored as Objects in Sui?

Yes, all NFTs are stored as Objects in Sui. Each NFT has a specific object type, making it easy to identify and manage different NFT collections.

Conclusion

Sui’s Object-based storage system redefines the way contracts, NFTs, and Coins are managed on the blockchain. By considering them as individual Objects, Sui offers a streamlined and efficient approach to handling digital assets. The concepts of NFT Collections, Token Values, and Package Contracts showcase the power and versatility of Sui’s”

About Chainbase

Chainbase is an all-in-one data infrastructure for Web3 that allows you to index, transform, and use on-chain data at scale. By leveraging enriched on-chain data and streaming computing technologies across one data infrastructure, Chainbase automates the indexing and querying of blockchain data, enabling developers to accomplish more with less effort.

Want to learn more about Chainbase?

Visit our website chainbase.com Sign up for a free account, and Check out our documentation.

WebsiteBlogTwitterDiscordLink3

hoshikarakitaridia ,

Yeah this is just an ad. Admins plus remove. Maybe ban user as well?

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines