DEV Community

Cover image for Guide: How to Develop Web3 DApps on Mint Blockchain Using NFTScan API
NFT Research
NFT Research

Posted on

Guide: How to Develop Web3 DApps on Mint Blockchain Using NFTScan API

Mint Blockchain is an L2 blockchain built on the OP Stack that focuses on innovation in the NFT space. It is dedicated to promoting innovation in NFT asset protocol standards and the widespread adoption of NFT assets in real-world commercial scenarios. The underlying ledger security of Mint Blockchain is fully based on the security consensus of the Ethereum network.

As an L2 network, it is a public blockchain network that is fully compatible with the EVM, allowing developers in the Ethereum ecosystem to seamlessly expand their projects to the Mint Blockchain network, providing effective scalability for the Ethereum ecosystem.

According to data from NFTScan, as of May 27th, Mint Blockchain has issued a total of 401,104 NFT assets, with 67 NFT contracts, 403,183 interaction records, 381,169 wallet addresses that have interacted, and a total transaction volume of 0.25 ETH.

Explore it now: https://mint.nftscan.com/

Image description

Create an NFTScan Developer Account
Before using the NFTScan API, you need to visit the developer’s website and create an account. Go to the NFTScan official website and click the “Sign Up” button for the NFTScan API to register.

Click here: https://developer.nftscan.com/user/signup

Image description

After logging in, find your unique API KEY on the Dashboard. Visit the API documentation and enter your API KEY in the appropriate location. Follow the instructions in the documentation to start using the API service. In the API documentation, developers can find various interface modes to choose from and select the most suitable one based on their needs.

Image description

In the Dashboard, developers can also view statistical data on their API usage, which helps track historical usage data. Additionally, NFTScan provides 1M CU of API call service to all registered developers for requesting all NFT API interfaces, and the CU never expires until it is used up!

Check Mint NFT API Docs
After successfully registering a developer account and obtaining your API Key, you will need to access the NFTScan API documentation. The API documentation contains all available API endpoints and parameters, as well as detailed information on how to construct requests and handle responses. Please read the API documentation carefully and ensure that you understand how to use the API to retrieve the data you need. The NFTScan API service aims to help developers improve their experience in accessing NFT data analysis.

Currently, NFTScan has the largest and most comprehensive NFT Collection library across 20+ blockchains including Ethereum, Solana, BNBChain, Bitcoin, TON, Polygon, zkSync, Aptos, Linea, Base, Avalanche, Arbitrum, OP Mainnet, Starknet, Scroll, Blast, Viction, Fantom, Mantle and more. It covers a wide range of NFT data, providing a complete set of interfaces to obtain ERC721 and ERC1155 assets, as well as transaction, project, and market statistics. It now supports over 60 public interfaces for EVM-compatible chains and a batch of similar model interfaces for Solana, Aptos, Bitcoin, and TON, greatly satisfying developers’ needs to index various types of NFT data.

Image description

Mint NFT API Models
The Mint NFT API includes three main models, providing developers with detailed information and descriptions of the core fields within these models. This enables developers to retrieve data and utilize the information to effectively serve their Dapp services.

Assets API: “Assets” represent the most crucial data fields within NFTs, uniquely identifying and describing digital assets. Developers can gain comprehensive insights and build relevant applications by extracting the “Assets” data from the Mint Blockchain. The “Assets” object provides the unique identification of digital assets, along with data about their entire lifecycle, laying the foundation for developers to understand and leverage NFTs.

Transactions API: The transactions model represents the complete history of all transactions related to an NFT asset on the blockchain, offering developers insights into the full lifecycle of NFT transactions. This includes minting, transfers, sales, and other transaction activities, allowing developers to gain an in-depth understanding of the flow and evolution of NFT assets within the Mint ecosystem. NFTScan continuously aggregates NFT transaction data from various blockchain networks, facilitating developers in tracking and understanding the dynamics of the NFT market. This data also assists developers in building NFT-based applications and tools.

Collections API: The Collections API provides NFTScan with off-chain data related to NFT collections, including descriptions, social media information, and other basic details. NFTScan retrieves this information through APIs provided by leading NFT markets across different blockchain networks. Additionally, the current floor price information is based on centralized data obtained through API from NFT market orders and is available for developers to access.

Image description

Mint 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 retrieve the detailed information of NFTs under a contract address using the “Get NFTs by contract” API endpoint “/v2/assets/{contract_address}”, with the path parameter of contract_address as the selection.

In this case, we are querying the detailed data of NFTs under the contract address 0x776fcec07e65dc03e35a9585f9194b8a9082cddb, named GreenID.

Image description

Click on Try it, the data is retrieved as follows, the data response shows the basic data and metadata information of all items in the NFT Collection. Here we select GreenID, you can see that there are a total of 374248 items in this project, and the returned data is sorted by token_id. For example, the item with id 1:

A single item data:
0x776fcec07e65dc03e35a9585f9194b8a9082cddb, named GreenID, with NFT Token id 1, representing 1% in the project. The protocol standard is erc721. Data includes the wallet address of the owner at the time of minting, timestamp of minting/hash address of Mint, Token URI address, latest_trade_price, latest_trade_symbol, latest_trade_timestamp, etc.

Metadata: Metadata for this project is hosted on IPFS, with token_uri at https://www.mintchain.io/api/tree/metadata/1. Format is image/png, and includes storage path and description of detailed features of the image.

Rarity description: Includes score and overall rarity ranking.

Image description

2/ Retrieve Transactions Series

  • Get transactions by account (This interface retrieves a list of NFT transactions for a wallet address)
  • Get transactions by contract (This interface retrieves a list of NFT transactions for an NFT contract address
  • Get transactions by NFT (This interface retrieves a list of NFT transactions for a single NFT)
  • Search transactions (This interface retrieves a list of NFT transactions by applying search filters in the request body)
  • Get transactions by address (This interface retrieves a list of NFT transactions filtered by transaction parameters)
  • Get transactions by hash (This interface retrieves transaction records based on a list of transaction hashes)

Here we can retrieve the transaction records of a specific NFT contract address by using the “Get transactions by NFT” “/v2/transactions/{contract_address}/{token_id}” endpoint. The query parameters allow us to select the NFT event types (Mint/Transfer/Sale/Burn) by using ‘;’ to separate multiple events.

In this case, we are retrieving the Mint transaction records of the NFT token with tokenID 1. We can choose to include all event types (Mint/Transfer/Sale/Burn) in the query. The response data will contain key transaction details for all transactions related to this NFT item, such as transaction hash, From and To addresses, block information, gas consumption, transaction timestamp, and other basic data about the NFT transactions. The data returned shows that there is currently only one Mint-related transaction record for this item.

Image description

3/ Retrieve Collections series

  • Get an NFT collection (Retrieve details based on the contract address of the collection, including an overview and categorization of items based on their descriptions, distribution of owners, average price, floor price, and other basic information)
  • Search NFT collections (This endpoint retrieves a list of Collection information by applying search filters in the request body. Collections are sorted in ascending order based on deployment block number)
  • Get NFT collections by account (This endpoint retrieves 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 retrieves a list of collections with a given ranking field, sorted based on the given sorting field and sorting direction)

Here we retrieve details of an NFT collection with the address 0x776fcec07e65dc03e35a9585f9194b8a9082cddb and the name GreenID through the API endpoint “/v2/collections/{contract_address}”.

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 mainly return the distribution of holders for an NFT Collection through the interface Collection Top Holder “/v2/statistics/collection/holder/{contract_address}”, which can be referred to as NFTScan 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 APIs is commonly used to retrieve data analysis and statistics-related information on the NFT Explorer of Mint, such as Trade Ranking and Mint Amount. Such APIs allow developers or users to query, analyze, and retrieve statistical data related to specific data sets or indicators and can be used for various purposes, including market analysis, trend tracking, investment decision-making, and understanding the nature of specific data.

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 (Retrieve the latest block number reached by NFTScan)
  • Get the latest reorganization block numbers
  • Get NFT amount by account (Retrieve the quantity of ERC721 and ERC1155 NFT owned by the account address provided in the request body)
  • Get NFT owners by contract (Retrieve a list of owners of ERC721 NFTs for the given contract address, sorted by token_id)
  • Get owners by an NFT (Retrieve a list of owners of ERC1155 NFTs, sorted by account address)

Building NFTAPI Requests
Building NFTAPI requests related to NFTScan is very simple and convenient. Developers just need to browse the API documentation to find the desired endpoints, and understand the endpoint URL, request method, parameters, etc. Then, based on their requirements, they can choose a programming language such as JavaScript, Python, Java, etc. and use the HTTP request library of that language to send the constructed requests to the endpoint URL. When writing the code, developers just need to organize the API parameters, such as contract address, API Key, etc., and call the corresponding NFTScan endpoint to retrieve standardized JSON data easily.

Here, we use the API endpoint “Get an NFT collection”/v2/collections/{contract_address} to fetch details data of the GreenID project on MintBlockchain with the contract address 0x776fcec07e65dc03e35a9585f9194b8a9082cddb. We can make an HTTP GET request to NFTScan’s API endpoint using Python’s requests library like this:

import requests
def get_nft_collection_details(contract_address, api_key): base_url = "https://api.nftscan.com/v2/collections/" url = f"{base_url}{contract_address}" headers = { "Content-Type": "application/json", "x-api-key": api_key }
response = requests.get(url, headers=headers)
if response.status_code == 200:
return response.json()
else:
return {"error": f"Failed to retrieve data: {response.status_code}"}
Example usage
contract_address = "0x776fcec07e65dc03e35a9585f9194b8a9082cddb" api_key = "your_api_key_here"
nft_details = get_nft_collection_details(contract_address, api_key) print(nft_details)
Code Interpretation:
Import requests library: Use import requests to import the required library.

Define function get_nft_collection_details:

contract_address: NFT contract address.

api_key: API Key for authentication.

Build URL: Concatenate the base URL with the contract_address.

Set request headers: Including Content-Type and x-api-key, the latter is used for authentication.

Send request: Use requests. get to send a GET request.

Handle response:

If the request is successful (status code 200), return JSON data.
Otherwise, retrieve an error message.
This code is just an example, developers should refer to the actual application for construction. Make sure to replace your_api_key_here with the actual API Key.

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)