DEV Community

Cover image for Guide: How to Develop Web3 Dapp on PlatON Using NFTScan API?
NFT Research
NFT Research

Posted on

Guide: How to Develop Web3 Dapp on PlatON Using NFTScan API?

PlatON is a next-generation global computing architecture developed by Wanxiang Blockchain and Matrix Elements. It is revolutionary in its use of the meta-computing framework Monad and the isomorphic multi-chain architecture based on the Reload overlay network. The platform’s vision is to be the first operational service network that delivers complete privacy protection. It offers computing, storage, and communication services, as well as various basic resources such as computing power, algorithms, and data. Additionally, it provides public infrastructure software development, consulting, and operational services.

Based on NFTScan data, as of January 5th, the PlatON network has issued 2,710,774 NFT assets and has 2,261 NFT collections. The platform has generated 6,865,324 interaction records, involving 1,180,646 wallet addresses, and a total transaction volume of 190,295.2 LAT.

PlatON NFTScan:https://platon.nftscan.com/

Image description

Accessing the NFTScan NFT

Step 1: Create a NFTScan Developer Account

Before utilizing the NFTScan API, visit the NFTScan developer platform and create an account. Go to the official NFTScan website and click on the “Sign Up” button under NFTScan API.

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

Once logged in, find your unique API KEY on the Dashboard. Visit the API documentation and input your API KEY in the designated location. Follow the documentation’s instructions to start using the API services. In the API documentation, developers can find multiple interface modes to choose from based on their requirements.

Developers can monitor their API usage statistics in the Dashboard, which helps in keeping track of historical data. Furthermore, NFTScan offers each registered developer 1M CU of API calls, which can be used for requesting all NFT API interfaces, and these CU never expire.

Step 2: View PlatON API Documentation

After successfully registering a developer account and obtaining an API Key, you need to review the NFTScan API documentation. The API documentation contains all available API endpoints and parameters, as well as detailed information on how to build requests and handle responses. Please read the API documentation carefully and make sure you understand how to use the API to obtain the data you need.

NFTScan is currently the platform with the largest and most comprehensive NFT Collection library across various blockchains. It supports complete NFT data from 21 blockchains, including Ethereum, Solana, BNBChain, Bitcoin, TON, Polygon, zkSync, Aptos, Linea, Base, Avalanche, Arbitrum, OP Mainnet, Starknet, Scroll, Viction, Fantom, Moonbeam, PlatON, Cronos, and Gnosis. The platform offers a wide range of NFT data, covering various types of assets, and provides a comprehensive set of APIs to access information on ERC721 and ERC1155 assets, transactions, projects, market statistics, and more. Currently, it supports over 60 public interfaces for EVM-compatible chains and also provides a series of interfaces for Solana, Aptos, Bitcoin, and TON. This extensive support caters to the diverse needs of developers seeking to index different types of NFT data.

PlatON NFT API Model

This comprises three primary model interfaces, each with an overview and explanation of core API fields to assist developers in accessing and utilizing data for their Dapp services under development.

Assets API: “Assets” represent the most critical data fields within NFT, uniquely identifying and describing digital assets. Developers can extract “Assets” data from NFTs on the PlatON to gain comprehensive insights and construct relevant applications. The “Assets” object provides a unique identification for digital assets and data about their entire lifecycle, serving as a foundation for developers to understand and utilize NFTs.

Transactions API: The transaction model represents the complete transaction data for an NFT asset on the blockchain, offering developers a full view of an NFT’s transaction history. This includes NFT minting, transfers, sales, and other transaction activities, providing developers with an opportunity to deeply understand the flow and evolution of NFT assets within the PlatON ecosystem. NFTScan continuously aggregates the NFT transaction market and related contract information from various blockchain networks. Currently, NFTScan has compiled data for tracking and understanding NFT market dynamics, aiding developers in building NFT-based applications and tools.

Collections API: NFTScan retrieves off-chain data related to NFT Collections, including descriptions, social media, and other fundamental information. This data is obtained from the most popular NFT markets provided through various blockchain networks. Additionally, floor price information is centralized data derived from order information on NFT markets, and it can be accessed via API.

Image description

PlatON NFT API Retrieval

1/ Retrieve Assets Series

  • Get NFTs by account (Retrieve NFTs using a wallet address)
  • Get all NFTs by account (Retrieve all NFTs associated with a wallet address and group them by contract address. If the total number of NFTs owned by the account exceeds 2000, the returned NFTs will be limited to 2000 or less. In such cases, developers and users can use pagination queries to retrieve all NFTs owned by the account.)
  • Get minted NFTs by account (Retrieve NFTs minted by a specific wallet address)
  • Get NFTs by contract (Retrieve NFTs using a contract address, sorted by token_id in ascending order)
  • Get single NFT (Retrieve details of a single NFT)
  • Get multiple NFTs (Retrieve details of multiple NFTs from different 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 contract addresses with specific 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 a specific wallet address, grouped by contract address.)

Here, we can retrieve all the NFTs held by a specific PlatON wallet address using the API Get all NFTs by account “/v2/account/own/all/{account_address}”. The query parameters include the protocol standards: erc721/erc1155, and sorting fields: mint_time/own_time/last_trade_price (only applicable to erc721). In this case, we are requesting all the erc721 protocol NFTs on the PlatON chain for the address: lat1cghxn3j8j4h7sxw0rey9jzc9388tp7aede4870.

Image description

Clicking “Try it” generates a response showing that there are a total of three NFT Collections held at the given address, which are “PlatON Ecosystem Rabbit Red Packets,” “SA NFT,” and “HashKey DID.” The data is sorted in descending order by each collection’s floor price. The returned information includes the contract address and name of each NFT collection, the number of holdings per collection, the number of items under each contract address, and basic details such as floor price and other relevant information.

Image description

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 NFT 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 based on a list of transaction hashes)

We can use the API “Get transactions by account” “/v2/transactions/account/{account_address}” and the feature to search for NFT transaction records on the PlatON network associated with a particular wallet address. The query parameters allow us to choose which types of NFT events Mint/Transfer/Sale/Burn. Multiple events can be selected using “;” as a separator.

In this case, we will search for NFT transaction records associated with the address lat1cghxn3j8j4h7sxw0rey9jzc9388tp7aede4870. By selecting the Mint event type, the resulting response data will contain all key data for every Item Mint event associated with this address. This includes information such as transaction hash value, From and To addresses, block information, gas usage, transaction timestamp, and other basic data that characterizes NFT transaction events.

Image description

3/ Retrieve Collections Series

  • Get an NFT collection (Retrieve details based on the contract address of the collection, including an overview and classification of items based on descriptions, distribution of holders, average prices, floor prices, and other basic summary information)
  • Search NFT collections (This interface returns information about collections by applying search filters in the request body, and the collections are sorted in ascending order based on the deployment block number)
  • Get NFT collections by account (This interface returns a list of projects with the given account address, and the collections are sorted from high to low based on the floor price)
  • Get NFT collections by ranking (This interface returns a list of projects with the given sorting field, and the collections are sorted based on the specified sorting field and direction)

Here, we use the API “Get an NFT collection” (“/v2/collections/{contract_address}”) to retrieve the details of an NFT collection with the contract address lat1qjwjv237chk0nhv7xevumjf0g3wtcm73hqv9al and the name Plato_World. Each data entry in the returned response contains 32 data.

Image description

4/ Collection Statistics: Statistical Analysis for Collection

  • Collection Statistics (This interface provides an analytical overview of NFT Collection statistics)
  • Collection Trade Distribution (This interface primarily provides the distribution of project trades)
  • Collection Trending Statistics (Mainly returns trading statistics ranking for a project)
  • Collection Holding Amount Distribution (This interface can provide information on the distribution of NFT project holdings)
  • Collection Holding Period Distribution (Data returns information about the distribution of NFT project holding periods)
  • Collection Blue Chip Statistics (Overview statistics for blue-chip projects)
  • Collection Blue Chip List (List of blue-chip projects associated with the project, referring to NFTScan Blue Chip Collection)
  • Collection Top Holder (Distribution of the top holders of the Collection)

Here, we use the API Collection Holding Period Distribution “/v2/statistics/period/distribution/{contract_address}” to mainly retrieve the holding period distribution information of an NFT Collection. You can refer to PlatON’s on-chain NFTScan Holding Period Distribution for reference:

https://platon.nftscan.com/lat1qjwjv237chk0nhv7xevumjf0g3wtcm73hqv9al?module=Holders

Image description

5/ Account Statistics Series

Account Overview Statistics (This interface returns an overview of statistical information for an account address, refer to NFTScan Overview)
Account Holding Distribution (This interface returns statistical information on the distribution of NFT holdings for an account address, refer to NFTScan Portfolio)
Account Holding NFT Trending (This interface returns statistical information on the trending NFT holdings or quantities for an account address, refer to NFTScan Portfolio)

6/ Analytic Statistics Series

This series of interfaces is typically used to access various information related to data analysis and statistics on NFTScan Starknet. Interfaces such as Trade Ranking, Mint Amount, and Gas Ranking allow developers or users to query, analyze, and retrieve statistical data related to specific data sets or metrics. They can be used for various purposes, including market analysis, trend tracking, investment decision-making, and understanding the nature of specific data.

Reference: https://platon.nftscan.com/analytics

Image description

7/ Refresh Metadata

  • Refresh NFT metadata
  • Refresh NFT metadata by contract Interfaces like Refresh Metadata can assist developers or users in submitting backend tasks to refresh metadata. Once reviewed, these tasks will refresh the specified item or the entire contract metadata.

8/ Other

  • Get the latest block number (Returns the latest block number reached by NFTScan)
  • Get NFT amount by account (Returns information on the quantity of ERC721 and ERC1155 NFTs owned by the account address specified in the request body)
  • Get NFT owners by contract (Returns a list of owners for the specified ERC721 NFT contract address, with NFTs sorted by token_id)
  • Get owners by an NFT (Returns a list of owners for the specified ERC1155 NFT, with NFTs sorted by account_address)

Building Relevant NFT API Requests

Once developers find the required PlatON API interfaces and parameters in the NFTScan API documentation, they can use their chosen programming language (such as Python, Java, JavaScript, etc.) to write API request code. Here is an example that demonstrates how a Python script can be used to request details of NFTs held by a wallet address.

For instance, to obtain the NFT details held by the address “lat1cghxn3j8j4h7sxw0rey9jzc9388tp7aede4870,” we can use the HTTP GET request interface “v2/account/own/{account_address}” and the Python requests library to construct the request as shown below:
`import requests

Define NFTScan API endpoint and account address

api_endpoint = "https://api.nftscan.com/v2/account/own"
account_address = "lat1cghxn3j8j4h7sxw0rey9jzc9388tp7aede4870"

Construct API request URL

url = f"{api_endpoint}/{account_address}"

Make an HTTP GET request

response = requests.get(url)

Check if the request was successful

if response.status_code == 200:
# Get the returned JSON data
data = response.json()
# Process the returned NFT details
print("Owner's NFT details:")
print(data) # This will print the retrieved NFT details; you can further process or extract information as needed
else:
print("Request failed:", response.status_code)
After running the code, developers will receive detailed information on the NFTs held by the address and can further process or extract the information as required.`

Image description

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

Top comments (0)