NFTScan NFT API Application in DID Protocol Development

NFTScan
NFTScan
Published in
9 min readAug 17, 2023

Since the development of the internet, the Web 2.0 era has given rise to a networked society where geographical boundaries are no longer limiting. With the introduction of Web 3.0, decentralized concepts have emerged, emphasizing individual data privacy and trustworthy interoperability. In this new era, decentralized identities (Decentralized Identifiers, or DID) have emerged. DID allows users to have complete control over their digital identities without the need for central authorities. Based on blockchain technology, DID can be used across different platforms and manage associations with multiple identities, aligning with the decentralized philosophy of Web3.

For the DID Protocol platform, DID enables users to use encrypted wallets as digital identity markers, and the authenticity of these identities can be verified through NFTs. This reduces fraudulent and fake activities, ensuring that the platform possesses authentic and trustworthy user data. Of course, the operation of the DID Protocol requires support from NFT data, providing enhanced security, credibility, and transparency for digital asset ownership, transactions, and identity verification:

  1. Ownership and Source Verification: Creators can attach their Web3 identity to NFTs, easily proving their authorship. Buyers and others can verify the origin and authenticity of NFTs by validating DIDs, reducing the risk of fake works.
  2. Transaction Transparency: Blockchain ensures transparent and traceable ownership transactions of NFTs, helping to eliminate potential disputes and provide integrity of transaction history.
  3. Enhanced Identity Verification: In the NFT marketplace, buyers and sellers can authenticate using DIDs. Sellers can increase buyer trust by displaying identity-related information linked to their DID. Buyers can also verify their identity using their DID, ensuring legitimate transactions with sellers.
  4. Digital Rights Management: Offers more flexible solutions for managing and controlling digital assets. Creators can use their DID to manage their works and have granular control over access and usage.
  5. Smart Contract Interaction: This enables smart contracts to interact with identity verification, permission management, and digital asset ownership. Provides advanced functionality for various use cases.

DID Protocol development teams often face challenges in obtaining NFT data, involving complexities and efforts. Integrating and handling NFT data within applications is a demanding task, requiring expertise across various technical domains such as blockchain integration, data accuracy, and privacy protection. To overcome these challenges, NFT data service providers play a crucial role by offering standardized data interfaces, making it easier for development teams to integrate NFT data into their applications without dealing with adaptability issues across different data sources and formats.

NFTScan provides a professional and reliable API interface that allows developers to directly access comprehensive and real-time updated NFT data. This eliminates the need for developers to handle complex on-chain data fetching, significantly boosting development efficiency and reducing maintenance costs. Developers can focus more on application innovation and leverage NFTScan’s multi-chain NFT data to rapidly build powerful applications and deliver exceptional user experiences. Using NFTScan’s rich multi-chain NFT data directly is undoubtedly the optimal choice compared to developing an on-chain data fetching system from scratch.

How to Access the NFTScan NFT API

  1. Create a NFTScan Developer Account

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

NFTScan Developer: https://developer.nftscan.com/user/signup

Sign Up (NFTScan Developer Platform)

After logging in, find your unique API KEY on the Dashboard and copy it. Visit the API documentation and input your API KEY as guided. You can then start using the API service. In the API documentation, developers can find various interface modes to choose from based on their needs.

Dashboard (NFTScan Developer Platform)

In the Dashboard, developers can also view statistics on their API usage, helping to track historical usage data. Moreover, NFTScan provides each registered developer with 1M CU (Call Units) of API calls, allowing access to all NFT API interfaces, and CU never expires.

2. View the NFT API Documentation

After successfully registering as a developer and obtaining your API Key, you need to review the NFTScan API documentation. The API documentation includes all available API endpoints and parameters, along with detailed instructions on how to build requests and handle responses. Carefully read the API documentation and ensure you understand how to use the API to retrieve the data you need.

NFTScan API Documentation: https://docs.nftscan.com

NFTScan API services aim to enhance developers’ experience in obtaining NFT data analysis. NFTScan currently boasts the largest and most comprehensive NFT Collection library, supporting full NFT data for Ethereum, Solana, BNBChain, Bitcoin, Polygon, zkSync, Aptos, Linea, Avalanche, Arbitrum, Optimism, Fantom, Moonbeam, PlatON, Cronos, and Gnosis on 16 blockchains.

The covered NFT data is diverse, providing a complete set of interfaces for accessing ERC721 and ERC1155 assets, transactions, projects, market statistics, and more. It supports over 50 public interfaces for EVM-compatible chains and a set of similar interfaces for Solana, Aptos, and Bitcoin, satisfying developers’ needs to index various types of NFT data.

NFTScan API Doc

3. NFTScan API for Retrieving NFT-Related Data

  • Retrieve Assets: A core API for retrieving NFT asset data. The core data model in NFTScan API is Assets, representing unique digital items. It includes contract addresses, contract names, token IDs, ERC protocol standards, metadata JSON, image URIs, holders, rarity rankings, and comprehensive data about NFT projects, asset lists, and details.
  • Retrieve Transactions: This API retrieves NFT transaction records, comprehensively recording NFT trade markets and transaction contract information on various blockchain networks. It offers in-depth analysis based on contract source codes and transaction logs, contributing to data parsing logic. As of mid-August, NFTScan has recorded a total of 1,912,038,356 NFT on-chain records across the 16 most prominent chains, covering 162 trading markets.
  • Retrieve Collections: This API retrieves NFT Collection asset data, providing essential information about NFT Collections and the data held by wallet addresses. Descriptions, social media, and other basic information about NFT Collections can be obtained through APIs offered by leading NFT markets on various blockchain networks. Additionally, floor price information is centralized data obtained through APIs based on market orders.
  • Collection Statistics: This API provides comprehensive statistics for NFT Collections, offering key statistical indicators such as holder distribution, circulation rate, trading volume, and price trends. These statistics play a vital role in product design, market research, and asset evaluation. Utilizing this data, developers can deeply analyze Collection activity and value, study user preferences, explore trading patterns, build quantitative trading models, predict market trends, and create real-time dashboards for NFT Collection statistics.
  • Account Statistics: This API offers comprehensive statistics for NFT user accounts, providing core statistical indicators such as the number of NFTs held, total value held, and historical transaction data. This data is essential for product design, user research, customer profiling, and more. By analyzing account statistics, developers can delve into different wallet address trading behaviors, asset allocations, and category preferences, enabling precise user growth, product recommendations, and marketing initiatives.
  • Analytic Statistics: This API offers in-depth analysis of NFT data, providing insights such as NFT ranking, trend forecasts, and more. These analytical data help data-driven decision-making and strategic planning. Utilizing this data, developers can understand hot topics and trends within NFT projects, adjust product positioning, enhance the application value of NFT data, and visualize DID identities with more forward-looking content.
Source: NFTScan API Doc

NFTScan provides comprehensive core NFT data. The application of DID Protocol can achieve various innovative functionalities and gain significant advantages: Metadata support generates on-chain verifiable DID documents, transaction and holder data prove asset origin and ownership changes, timestamp data ensures credible event sequencing, statistical and analytical data help with modeling and developing quantitative strategies, resources like images and videos enhance the expressiveness of DID documents, trend predictions assist in presenting DID identities with more foresight, and direct application of NFT data to DID identities enables features like showcasing collections and social interactions.

4. Querying Relevant API Requests

4.1 Account Overview Statistics:

“/v2/statistics/overview/{account_address}”

This API provides comprehensive statistics for each account, offering insights into a user’s overall NFT asset portfolio. This information enhances DID Profile displays, allowing analysis of different user transaction behaviors and preferences, and facilitating user segmentation and personalization.

This provides an overview of statistical information related to account addresses, which can be referred to as the NFTScan Overview:

Account Overview Statistics

By clicking on ‘Try it’, the data response is as follows:

A total of 16 data were returned, including the holding value of the wallet address being 986.5797e; the total buy amount being 212.56e; the total sell amount being 669.24e; the gas consumption being 0.9e; the holding value in USDT being 1803605.81u; the buy amount in USDT being 388589.44u; the sell amount in USDT being 1223471.73u; the gas consumption in USDT being 1649.11u; The number of NFT holdings is 645; The total number of NFT collections is 353; The number of minted NFTs is 288; 7 were bought and 70 were sold; 105 were sent and 642 were received; and 23 were burned.

Data retuned (Data source: NFTScan API doc)

4.2 Account Holding Distribution

“/v2/statistics/distribution/{account_address}”

This API reveals the distribution of NFT categories held by each wallet address. It provides rich content for DID displays, visually demonstrating user NFT preferences, and supports user segmentation and accurate recommendations based on category preferences.

It primarily provides the distribution statistics of NFT holdings under the wallet address, which can be referred to in the NFTScan Portfolio:

https://portfolio.nftscan.com/account/0xca1257ade6f4fa6c6834fdc42e030be6c0f5a813

The data response results indicate that there are currently a total of 6 items under this address:

Data returned (Data source: NFTScan API doc)

5. Building Relevant NFT Requests

Constructing NFT-related requests with NFTScan is straightforward. Developers only need to find the desired interfaces in the API documentation, review interface addresses, request methods, and parameters. Based on their programming language of choice, such as JavaScript, Python, Java, etc., developers can use the respective HTTP request libraries to send well-constructed requests to the interface addresses, including necessary headers and parameters. The calling process is quick and convenient, allowing developers to implement it based on the documentation.

For example: let’s request NFT statistics for a wallet address using the “/v2/statistics/overview/{account_address}” API endpoint.

With an HTTP GET request to the NFTScan API endpoint and using Python’s requests library, the request can be constructed as follows:

In the above code, we first defined the base URL of the NFTScan API and then specified the wallet address to query. By concatenating the wallet address to the base URL, we constructed the complete request URL. Next, we used the get method of the requests library to initiate an HTTP GET request and handled the returned data based on the response status code.

Please note that the above example demonstrates how to use the Python requests library to build an HTTP GET request to access the NFTScan API endpoint. In real-world usage, developers may need to consider error handling, authentication, parameter passing, and other details. When using the API, refer to the official NFTScan documentation for accurate API endpoints and parameter information, and follow best practices to ensure data security and accuracy.

About NFTScan

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 16 blockchains including Ethereum, Solana, BNBChain, Arbitrum, Optimism, and other major blockchains, providing NFT API for developers on 16 blockchains.

Official Links:

NFTScan: https://nftscan.com/

Developer: https://developer.nftscan.com/

Twitter: https://twitter.com/nftscan_com

Discord: https://discord.gg/nftscan

--

--