🛠️ Guide: How to Develop Web3 dApps on Sei Network Using NFTScan NFT API

NFT Research - Aug 28 - - Dev Community

Gravity is a Layer-1 blockchain designed for massive adoption and the multi-chain future. Its approach abstracts away the technical complexities of multi-chain interoperability, integrating cutting-edge technologies like zero-knowledge proofs, advanced consensus mechanisms, and a re-staking-driven architecture to ensure high performance, enhanced security, and cost-effectiveness. Adopting a cross-chain settlement protocol, it aims to leverage its high performance and fast finality chain capabilities fully.

According to data from NFTScan, as of August 27th, a total of 18,633 NFT assets have been issued on the Gravity Network, with 32 NFT Collections and 18,700 interaction records generated, involving 17,630 unique wallet addresses.

👉 Gravity NFTScan: https://gravity.nftscan.com/

Creating an NFTScan Developer Account

Before starting to use the NFTScan API, you need to visit the developer website and create an account. Go to the official NFTScan website and click the “Sign Up” button for NFTScan API to register.

Sign Up - NFT API | NFTScan Developer Platform developer.nftscan.com

After logging in, find your unique API KEY on the Dashboard, and copy it. Access the API documentation, and enter your API KEY in the appropriate field. Following the guidance in the documentation, you can start using the API service. In the API documentation, developers can find various interface modes to choose from based on their needs.

In the Dashboard, developers can also view statistics on their API usage, helping to record historical usage data. Moreover, NFTScan provides each registered developer with 1M CU of API call service to request all NFT API interfaces, and the CU never expires, until it’s used up!

Check Gravity NFT API Documentation

After successfully registering a developer account and obtaining an API Key, you need to review the NFTScan API documentation. The API documentation includes all available API endpoints, parameters, and detailed information on how to construct requests and handle responses. Please read the API documentation carefully and ensure you understand how to use the API to obtain the data you need. The NFTScan API service is dedicated to helping developers improve their experience in obtaining NFT data analysis.

Currently, NFTScan has the largest and most comprehensive NFT Collection database, supporting full NFT data from 25 blockchains, including Ethereum, Solana, BNBChain, Bitcoin, Mint, and more. The NFT data covered is comprehensive and diverse, providing a complete set of interfaces to obtain information on ERC721, ERC1155, ERC404, ERC6551 assets, as well as transactions, projects, and market statistics. It now supports over 60 public interfaces for EVM-compatible chains, as well as a batch of interfaces with the same model for Solana, Aptos, Bitcoin, and TON, largely meeting developers’ needs for indexing various types of NFT data.

Gravity NFT API Models

The main models include the following three API models, including an overall introduction and explanation of some core fields in the APIs, to help developers understand how to obtain data and utilize this information to serve the Dapp services they are building.

Assets API: “Assets” is the most critical data field in NFTs, used to uniquely identify and describe digital assets. Developers can gain a comprehensive understanding by extracting the “Assets” data of NFTs on Gravity blockchain and building relevant applications. The “Assets” object provides a unique identifier for digital assets and data throughout their entire lifecycle, providing a foundation for developers to understand and apply NFTs.

Transactions API: The transaction model represents the complete transaction data of an NFT asset on the blockchain, providing developers with the complete lifecycle transaction information of the NFT. This includes the NFT’s mint, transfer, sale, and other transaction activities, allowing developers to gain a deep understanding of the flow and evolution of the NFT asset within the Gravity ecosystem. NFTScan continuously aggregates information from various blockchain networks’ NFT transaction marketplaces and related transaction contracts. Currently, NFTScan has indexed data for tracking and understanding NFT market dynamics, which also helps developers build NFT-based applications and tools.

Collections API: NFTScan obtains off-chain data related to NFT Collections, such as descriptions, social media, and other basic information. NFTScan acquires this information through the APIs provided by the most popular NFT marketplaces across various blockchain networks. Additionally, the current floor price information is based on the centralized data of order information from NFT marketplaces, which is also accessible via APIs.

1/ Retrieve Assets Series
Get NFTs by account (Retrieve NFTs by wallet address)

Get all NFTs by account (Retrieve all NFTs owned by a wallet address, grouped by contract address. If the total number of NFTs owned by the account address exceeds 2000, the returned NFTs will be limited to less than 2000. In this case, developers and users can use paged queries to retrieve all NFTs owned by that account address)

Get minted NFTs by account (Retrieve the Minted NFTs of the wallet address)

Get NFTs by contract (Retrieve NFTs by contract address, sorted by token_id in ascending order)

Get single NFT (Retrieve a single NFT)

Get multiple NFTs (Retrieve NFTs from multiple contract addresses simultaneously)

Search NFTs (This interface returns a list of NFT assets by applying search filters in the request body. Assets are sorted by nftscan_id in ascending order)

Get NFTs by attributes (This interface returns a set of NFTs belonging to NFT contract addresses with attributes. NFTs are sorted by token_id in ascending order)

Get all multi-chain NFTs by account (This interface returns all multi-chain NFTs owned by an account address, grouped by contract address)

For example, we use Get NFTs by contract “/v2/assets/{contract_address}” to retrieve NFT details for a contract address, with the contract_address as the path parameter. In this case, we query the Galxe — OAT project.

2/ Retrieve Transactions Series
Get transactions by account (This interface returns a list of NFT transactions for a wallet address)

Get transactions by contract (This interface returns a list of NFT transactions for an NFT contract address)

Get transactions by NFT (This interface returns a list of transactions for a single NFT)

Search transactions (This interface returns a list of NFT transactions by applying search filters in the request body)

Get transactions by address (This interface returns a list of NFT transactions filtered by transaction parameters)

Get transactions by hash (This interface returns transaction records queried by a list of transaction hashes)

For example, we use the Get transactions by contract interface “/v2/transactions/{contract_address}” to retrieve NFT transaction records for a contract address. The query parameters can optionally filter for NFT event types (Mint/Transfer/Sale/Burn), separated by ‘;’.

Similarly, here we retrieve the NFT transaction records for Galxe-OAT. Filtered by the Mint event type, the response data includes all key data for the Items Minted in this NFT Collection, such as transaction hash values, From and To addresses, block information, gas consumed, transaction timestamps, and other basic NFT transaction characteristic information.

3/ Retrieve Collections Series
Get an NFT collection (Query details by the contract address of a Collection, including an overview, Items categorized by description, holder distribution, average price, floor price, and other basic summary information)

Search NFT collections (This interface returns a list of Collection information by applying search filters in the request body. Collections are sorted by deployment block number in ascending order)

Get NFT collections by account (This interface returns a list of projects owned by a given account address. Collections are sorted by floor price from high to low)

Get NFT collections by ranking (This interface returns a list of projects with a given ranking field. Collections are sorted by the given ranking field and direction)

For example, we use the Get an NFT collection “/v2/collections/{contract_address}” to retrieve details for the address 0xcbe29f1a6685a90f68552988898baebb59ea4374, named Galxe-OAT:

4/ Collection Statistics Series
Collection Statistics (This interface provides an overview of analytical statistics for an NFT Collection)

Collection Trade Distribution (This interface mainly provides the trade distribution of a project)

Collection Trending Statistics (Returns the Trading statistics ranking of a project)

Collection Holding Amount Distribution (This interface can return the holding amount distribution information for an NFT project)

Collection Holding Period Distribution (Returns the holding period distribution information for an NFT project)

Collection Blue Chip Statistics (Overview of Analytical Statistics for Blue Chip Collections)

Collection Blue Chip List (The list of Blue Chip Collections involved in the project, refer to NFTScan Blue Chip Collection)

Collection Top Holder (Distribution of the top holders for this Collection)

For example, we use the Collection Statistics “/v2/statistics/collection/{contract_address}” to return the analytical statistics overview for an NFT Collection. You can refer to: https://gravity.nftscan.com/0xcbe29f1a6685a90f68552988898baebb59ea4374

5/ Account Statistics Series
Account Overview Statistics (This interface returns overview statistics for an account address, refer to NFTScan Overview)

Account Holding Distribution (This interface returns the NFT holding distribution statistics for an account address, refer to NFTScan Portfolio)

Account Holding NFT Trending (This interface returns the NFT holding amount (or quantity) statistics for an account address, refer to NFTScan Portfolio)

6/ Analytic Statistics Series
This series of interfaces is typically used to obtain information related to data analysis and statistics on the NFTScan Gravity network, such as Trade Ranking, Mint Amount, etc. These interfaces allow developers or users to query, analyze, and retrieve statistics related to specific data sets or metrics. They can be used for various purposes, including market analysis, trend tracking, investment decisions, and understanding the nature of specific data.

7/ Refresh Metadata
Refresh NFT metadata

Refresh NFT metadata by contract

The Refresh Metadata interfaces can help developers or users submit background tasks to refresh metadata. After review, these tasks will refresh the metadata of the submitted specific Item or the entire contract.

8/ Other
Get the latest block number (Returns the latest block number reached by NFTScan)

Get the latest reorganization block numbers (Returns the latest reorganized block numbers)

Get NFT amount by account (Returns the number of ERC721 and ERC1155 NFTs owned by account addresses based on the search list in the request body)

Get NFT owners by contract (Returns a list of owners for an ERC721 NFT contract address, with NFTs sorted by token_id in ascending order)

Get owners by an NFT (Returns a list of owners for an ERC1155 NFT, sorted by account_address in ascending order)

Building Relevant NFT API Requests
Developers can use different languages to write code that calls the NFTScan API, such as Python, Java, JavaScript, etc. For example, in Python, you can use the requests library to initiate API requests; in JavaScript, you can use axios; in Java, you can use libraries like OkHttp or Retrofit. When writing the code, developers only need to organize the interface parameters, such as contract addresses, API Keys, etc., and call the corresponding NFTScan API, and they can conveniently obtain standardized JSON format data.

For example, we retrieve the NFT details for the contract address 0xcbe29f1a6685a90f68552988898baebb59ea4374, using the Get NFTs by contract with the path “/v2/assets/{contract_address}”. We send an HTTP GET request to access the NFTScan API, using the requests library in Python, and can construct the request like this:

import requests

Define the contract address and API path

contract_address = '0xcbe29f1a6685a90f68552988898baebb59ea4374'
api_url = f'https://api.nftscan.com/v2/assets/{contract_address}'

Set up the request headers, including the API key

headers = {
'Authorization': 'Bearer your_api_key_here', # Replace with your API key
'Content-Type': 'application/json',
}

Make the HTTP GET request

response = requests.get(api_url, headers=headers)

Check the response status

if response.status_code == 200:
# Parse the response data
nft_data = response.json()
print(nft_data)
else:
print(f'Request failed with status code: {response.status_code}')
NFTScan is the world’s largest NFT data infrastructure, including a professional NFT explorer and NFT developer platform, supporting the complete amount of NFT data for 20+ blockchains including Ethereum, Solana, BNBChain, Arbitrum, Optimism, Mint and other major networks, providing NFT API for developers on various blockchains.

Official Links:

NFTScan: https://nftscan.com

Developer: https://developer.nftscan.com

Twitter: https://twitter.com/nftscan_com

Discord: https://discord.gg/nftscan

Join the NFTScan Connect Program

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .