The Author: mumu
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.
NFTs are unique digital assets that represent ownership of a specific item, artwork, or collectable 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.
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.
Once we have the package ID, we can query all the move_calls (transactions) generated within that package:
select * from sui.move_calls where move_package = '0xee496a0cc04d06a345982ba6697c90c619020de9e274408c7819f787ff66e1a1';
Alternatively, we can find all the NFT objects within the package using the corresponding NFT object type:
select * from sui.objects
where object_type = '0xee496a0cc04d06a345982ba6697c90c619020de9e274408c7819f787ff66e1a1::suifrens::SuiFren<0x8894fa02fc6f36cbc485ae9145d05f247a78e220814fb8419ab261bd81f08f32::bullshark::Bullshark>';
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.
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>):
select sum(storage_rebate) as balance, owner_address from sui.objects where object_type = '0x2::coin::Coin<0x2::sui::SUI>' group by owner_address, storage_rebate order by balance desc limit 100;
Top Contracts are determined by grouping packages based on the number of interactions they have.
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:
select count(1) as score, move_package from sui.move_calls group by move_package order by score desc limit 100;
Objects in Sui refer to a unique approach where all contracts, NFTs, and Coins are considered individual Objects. This Object-based storage structure forms the core of Sui’s operations.
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.
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
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.
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.
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”
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.
Visit our website chainbase.com Sign up for a free account, and Check out our documentation.
Website|Blog|Twitter|Discord|Link3
The Original Link: Exploration of Sui Data Application Scenarios
【免责声明】市场有风险,投资需谨慎。本文不构成投资建议,用户应考虑本文中的任何意见、观点或结论是否符合其特定状况。据此投资,责任自负。