Guide: How to Develop Web3 dApps on Sei Network using NFTScan NFT API

NFTScan
NFTScan
Published in
9 min readJun 21, 2024

Sei Network is a Layer 1 blockchain that focuses on transactions, built on the Cosmos SDK and utilizing the Tendermint BFT consensus mechanism. It is designed not only for crypto asset trading in the DeFi space but also aims to create a multi-functional blockchain ecosystem in key verticals such as gaming, social media, and NFTs.

Sei Network strives to be the fastest and most scalable transaction blockchain, capable of processing thousands of transactions with sub-second finality. As of June 21st, NFTScan data shows that there have been 32,397 NFT assets issued on Sei Network, with 208 NFT Collections, 36,052 interaction records, 4,470 wallet addresses involved in interactions, and a total transaction volume of 13,189 SEI.

🔗 Sei NFTScan: https://sei.nftscan.com/

Create Your NFTScan Developer Account

The first step to start using the NFTScan API is to create a developer account on the NFTScan website. Visit the official NFTScan developer website and click the “Sign Up” button to register for an account. Simply follow the registration process by providing the necessary information.

Click here to create your NFTScan developer account:
➡️ https://developer.nftscan.com/user/signup.

Once logged in, navigate to the Dashboard to find your unique API KEY. Copy this key and paste it into the designated field in the API documentation. Follow the provided instructions in the documentation to begin using the API service. Within the API documentation, developers can explore different interface modes and select the most appropriate one based on their requirements.

In the Dashboard, developers can access statistics on their API usage to track historical data. Additionally, NFTScan provides each registered developer with 1M CU of API call services for accessing all NFT API interfaces. The CU never expires, allowing developers to use it until it is depleted.

View the Sei NFT API documentation

After successfully registering as a developer and obtaining an API Key, you will need to access the Sei NFT API documentation. The API documentation provides details on all available API endpoints and parameters, along with instructions on how to construct requests and handle responses. It is important to thoroughly review the API documentation to ensure you understand how to effectively use the API to retrieve the desired data.

The Sei NFT API service provides a comprehensive NFT Collection library, offering data from 24 blockchains such as Ethereum, Solana, BNBChain, Bitcoin, Mint, and more. The NFT data is diverse, covering various NFT types including ERC721, ERC1155, ERC404, and ERC6551, as well as transaction, project, and market statistics. With support for over 60 public interfaces for EVM-compatible chains and additional interfaces for other chains like Solana, Aptos, Bitcoin, and TON, developers have access to a wide range of NFT data indexing capabilities to effectively meet their analysis needs.

Sei NFT APIs

The core APIs consist of three main interfaces that provide an overview and explanation of the key fields in the NFT ecosystem. These APIs help developers understand how to access and utilize data for their Dapp services.

Assets API: The “Assets” API is essential for identifying and describing digital assets in NFTs on the Sei blockchain. By retrieving “Assets” data, developers can gain a comprehensive understanding of these assets and use the information to build related applications. This API provides a unique identifier for digital assets along with their complete lifecycle data, serving as a crucial resource for developers working with NFTs.

Transactions API: The Transactions API offers comprehensive data on the transactions involving NFT assets on the blockchain. It includes details on minting, transfers, sales, and other transaction activities, allowing developers to track the entire lifecycle of NFT transactions within the Sei ecosystem. NFTScan continuously aggregates transaction market data and contract information from various blockchain networks, enabling developers to analyze and understand the dynamics of the NFT market and build applications based on this data.

Collections API: The Collections API retrieves off-chain data related to NFT Collections, such as descriptions, social media links, and other fundamental information. This data is sourced from mainstream NFT market APIs across different blockchain networks. Additionally, floor price information, which is based on order data from the NFT market, can also be accessed through 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 account address owns more than 2000 NFTs, the returned NFTs will be limited to 2000 or less. In this case, developers and users can retrieve all NFTs owned by the account through paginated queries)
  • Get minted NFTs by account (Retrieve minted NFTs by the wallet address)
  • Get NFTs by contract (Retrieve NFTs by contract address and sort by token_id in ascending order)
  • Get single NFT (Retrieve a single NFT)
  • Get multiple NFTs (Retrieve multiple 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 certain attributes, sorted by token_id in ascending order)
  • Get all multi-chain NFTs by account (This interface returns all multi-chain NFTs owned by the account address, grouped by contract address)

Here we retrieve details of NFTs under a contract address using the API path “/v2/assets/{contract_address}” with the contract_address as the path parameter. In this case, we are querying the details of the NFTs under the contract address 0xa15b7162da988a788b00ac4fc0085f054b5ce7f4.

2/ Retrieve Transactions Series

  • Get transactions by account (This API returns a list of NFT transactions for a wallet address)
  • Get transactions by contract (This API returns a list of NFT transactions for an NFT contract address)
  • Get transactions by NFT (This API returns a list of transactions for a single NFT)
  • Search transactions (This API returns a list of NFT transactions filtered using search filters applied in the request body)
  • Get transactions by address (This API returns a list of NFT transactions filtered by transaction parameters)
  • Get transactions by hash (This API returns transaction records queried by transaction hash)

We are utilizing the API endpoint “v2/transactions/{contract_address}” to access NFT transaction records for a specific contract address. By employing query parameters, you can filter the results by NFT event types (Mint/Transfer/Sale/Burn) and include multiple events by separating them with ‘;’.

For this instance, we are retrieving TOSHIS’s NFT transaction records and emphasizing the Mint event type. The response data will comprise crucial information for Items Minted in this NFT Collection, including transaction hash, From and To addresses, block details, gas consumption, transaction timestamp, and fundamental data related to the specifics of the NFT transactions.

3/ Retrieve Collections Series

  • Get an NFT collection (Retrieve details of a collection based on the contract address, including an overview and categorization of items based on the description, holder distribution, average price, floor price, and other basic information)
  • Search NFT collections (This endpoint returns a list of collections based on search filters applied in the request body, sorted by deployment block number in ascending order)
  • Get NFT collections by account (This endpoint returns a list of collections associated with a given account address, sorted by floor price from highest to lowest)
  • Get NFT collections by ranking (This endpoint returns a list of collections sorted by a specified ranking field, sorted by the given ranking field and direction)

Here, we retrieve the details of a collection named TOSHIS with the address 0xa15b7162da988a788b00ac4fc0085f054b5ce7f4 through the endpoint “/v2/collections/{contract_address}”.

4/ Collection Statistics: Collection Statistics Series

  • Collection Statistics (provides an overview of statistical analysis for NFT Collection)
  • Collection Trade Distribution (provides trading distribution for the project)
  • Collection Trending Statistics (returns trading statistics ranking for a project)
  • Collection Holding Amount Distribution (returns distribution information for NFT project holdings)
  • Collection Holding Period Distribution (returns distribution information for NFT project holding periods)
  • Collection Blue Chip Statistics (overview data for blue-chip projects)
  • Collection Blue Chip List (list of blue-chip projects related to the project, refer to NFTScan Blue Chip Collection)
  • Collection Top Holder (distribution of top holders for the Collection)

Here we mainly focus on the interface Collection Statistics “/v2/statistics/collection/{contract_address}”, which primarily returns an overview of statistical analysis for an NFT Collection. You can refer to: https://sei.nftscan.com/0xa15b7162da988a788b00ac4fc0085f054b5ce7f4

5/ Account Statistics Series

  • Account Overview Metrics (This API provides an overview of statistical information for the account address, similar to NFTScan Overview)
  • Account Holding Distribution Analysis (This API offers statistical information on the distribution of NFT holdings for the account address, similar to NFTScan Portfolio)
  • Account Holding NFT Trend Analysis (This API presents statistical information on the trending NFT holdings quantity for the account address, similar to NFTScan Portfolio)

6/ Analytical Statistics Series

This series of interfaces is commonly utilized to access data analysis and statistical information on the NFTScan Sei network. Examples include Trade Ranking and Mint Amount. These interfaces enable developers and users to query, analyze, and retrieve statistical data related to specific datasets or metrics. They serve various purposes, from market analysis and trend tracking to making informed investment decisions and understanding specific data characteristics.

https://sei.nftscan.com/

7/ Refresh Metadata

  • Refresh NFT metadata
  • Refresh NFT metadata by contract

The Refresh Metadata API can help developers or users submit backend tasks to refresh metadata. Once approved, this task will refresh the specified item or the entire contract metadata that was submitted.

8/ Other

  • Get the latest block number (Return the latest block number reached by NFTScan)
  • Get the latest reorganization block numbers
  • Get NFT amount by account (Return the number of ERC721 and ERC1155 NFTs owned by the account addresses in the request body)
  • Get NFT owners by contract (Return a list of owners of ERC721 NFTs at the contract address, sorted in ascending order by token_id)
  • Get owners by an NFT (Return a list of owners of ERC1155 NFTs, sorted in ascending order by account_address)

Building NFT API requests

Developers can use different programming 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 make API requests; in JavaScript, you can use axios; in Java, you can use libraries like OkHttp or Retrofit. When writing the code, developers just need to organize the interface parameters, such as contract address, API Key, etc., call the corresponding NFTScan API, and easily retrieve standardized JSON format data.

Here, we query the NFT details data for the contract address 0xa15b7162da988a788b00ac4fc0085f054b5ce7f4, using the Get NFTs by contract API path “/v2/assets/{contract_address}”, making an HTTP GET request to the NFTScan API. Using the Python requests library, the request can be constructed as follows:

import requests

# Define the request URL and contract address
base_url = "https://api.nftscan.com/v2/assets/"
contract_address = "0xa15b7162da988a788b00ac4fc0085f054b5ce7f4"
url = f"{base_url}{contract_address}"

# Set up the request headers, assuming an API key is required
headers = {
"Authorization": "Bearer YOUR_API_KEY", # Replace with your actual API key
"Content-Type": "application/json"
}

# Send the GET request
response = requests.get(url, headers=headers)

# Check if the request was successful
if response.status_code == 200:
nft_data = response.json() # Parse the JSON response
print(nft_data)
else:
print(f"Request failed, status code: {response.status_code}")
print(response.text)

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, 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

--

--