How to Quickly Create an NFT Application Using NFTScan Solana API?
Tags: web3, nft, python, nftscan
Published: 2023-09-22 09:06:54

Previously, Solana has become one of the most favored public blockchains for NFT projects due to its exceptional performance and low fees. Numerous well-known NFT projects such as DeGods, Okay Bears, and Degenerate Ape Academy have chosen to launch on Solana. This means that Solana's blockchain generates a massive amount of NFT transaction data every day, with transaction records alone exceeding millions.

Furthermore, the number of newly created wallet addresses on Solana saw rapid growth from the end of April to May, with an increase of 3 million addresses in just one month. The number of active addresses also surged significantly in May, surpassing other time periods. The primary reason for this surge is that the Solana-based NFT marketplace Magic Eden launched a Bitcoin NFT market in March, and during the active period of Ordinals NFT trading, Magic Eden became one of the primary trading platforms.

Solana NFTScan：https://solana.nftscan.com/

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lz7yf1djlcmwf4r6re4s.png)

Currently, NFT trading volume on the Solana blockchain ranks second only to Ethereum. The main reason for this is the recent release of the SMB series, which garnered significant attention for a short period. According to NFTScan data, over the past month, the Solana blockchain has generated a total trading volume of $19.4 million, with the majority distributed across trading markets such as Magic Eden (41.79%) and Tensor (35.32%).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f1ynooq3khswt7xkp91y.png)

To collect and analyze various data within the entire Solana ecosystem, including collection growth, transaction trends, user behavior, and more, comprehensive observation of the Solana NFT ecosystem is required. This involves gathering all on-chain activities and processing them to transform them into valuable data products. NFTScan's Solana API covers multiple dimensions of data, including transactions, collections, statistical analysis, and more, offering a convenient way to access this data.

Developers can obtain rich Solana NFT data with simple API calls, eliminating the need to handle the complex process of extracting on-chain data themselves. This ease of building data interfaces, implementing data analysis, and providing data services for DApps significantly reduces the development barrier.

**How to Access the NFTScan NFT API**

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3a8amom839omwwracvo8.png)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.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h4gnue4kz5oes1y196q7.png)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.

**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, Base,TON,Avalanche, Arbitrum, Optimism, Fantom, Moonbeam, PlatON, Cronos, and Gnosis on 18 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.

Solana API mainly consists of the following five types of interfaces:
Retrieve Asset/Retrieve Transaction/Retrieve Collection/Statistics/Refresh Metadata, including an overall introduction and explanation of some core API fields inside them. This helps developers understand how to retrieve data and use this information to serve their DApp services they are currently building.

**Retrieve Asset Series:**
Get NFTs by account：/sol/account/own/{account_address}
Get all NFTs by account：/sol/account/own/all/{account_address}
Get minted NFTs by account：/sol/account/mint/{account_address}
Get NFTs by collection：/sol/assets/collection/{collection}
Get single NFT：/sol/assets/{token_address}
Get multiple NFTs：/sol/assets/batch

This type of API provides developers with a simple and efficient way to access various NFT data, including retrieving NFT lists related to user accounts or contract addresses, as well as obtaining detailed information about single or multiple NFTs. Developers can use these interfaces to directly access fundamental information and metadata of on-chain NFTs without the need to extract and process raw on-chain data themselves. These interfaces reduce the complexity of on-chain data, significantly lower the difficulty of obtaining detailed NFT data, and serve as a crucial foundation for developing Solana NFT-based DApps, data analysis, and other applications.

**Retrieve Transaction Series：**
Get transactions by account：/sol/transactions/account/{account_address}
Get transactions by collection：/sol/transactions/collection/{collection}
Get transactions by NFT：/sol/transactions/{token_address}

This type of interface conveniently retrieves various transactional information related to Solana NFTs occurring on the blockchain. It allows users to access the historical transaction records of a particular NFT based on criteria such as account, collection, asset address, and returns key data for each transaction. These interfaces provide raw on-chain block event data, eliminating the need for developers to handle on-chain extraction. Through simple API calls, developers can obtain the required Solana NFT transaction data. With access to this data, developers can implement applications such as data analysis and transaction systems based on it.

**Retrieve Collection Series:**
Get an NFT collection：/sol/collections/{collection}
Search NFT collections：/sol/collections/filters

By specifying a collection address or filtering criteria, you can search for NFT collections and receive a list of collections that match the specified conditions. Developers can use these interfaces to obtain an overview and list of any project and develop applications based on this information. For example, a data analytics platform can compile statistics on each collection and display information about popular NFT collections.

**Statistics Series:**
Trade Ranking：/sol/statistics/ranking/trade
Collection Statistics：/sol/statistics/collection/{collection}

The Trade Ranking interface allows you to retrieve the NFT trading rankings on the Solana blockchain, while the Collection Statistics interface, by specifying a project address, provides key statistical data for that collection. These statistical interfaces greatly simplify the work for developers to obtain NFT data for statistical analysis, enabling the creation of NFT trading analysis platforms or providing crucial statistical parameters for NFT applications.

**Refresh Metadata：**
/sol/refresh/metadata

This interface is used to submit a background task for refreshing the metadata of a specified NFT asset.

**Query Related API ** 

1/ Get transactions by NFT:  /sol/transactions/{token_address}
By using this endpoint from the NFTScan Solana API, developers can search for a specific NFT and retrieve a list of transactions associated with that NFT. The transactions are sorted in descending order by timestamp.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y73lzm94b8f44myg708s.png)

By inputting the Token address for NFT retrieval and using the "limit" and "cursor" parameters to control the number of items per page and the page number, clicking "Try it" will return a data list containing all transaction details under that single NFT. Here, we are querying all transaction records for Okay Bears #4632:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tk5rgg5i1a741y4hgsfd.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i4590p2gbv26kx6m1ljy.png)

2/ Get an NFT collection: /sol/collections/{collection}
This interface not only provides centralized information about the collection but also includes descriptions and categorizations of the NFT features within that project. For example, within an NFT Collection, different NFTs may be categorized based on various features such as "Fur" color, "Eyes" expression, "Background," "Mouth," "Clothes," "Hat," and so on. The interface will return information about the quantity of NFTs categorized under each feature description.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aluuql4dkhm74j5t5pd1.png)

3/ Trade Ranking:  /sol/statistics/ranking/trade 
This interface can provide ranking data for the trading volume of NFT projects on the Solana blockchain. The query parameters include specifying a time range (15 minutes to 1 day) and sorting criteria (Volume/Sales) to calculate the total trading volume for each NFT project and return a list of NFT projects with the highest trading volume. The list will display basic information for each project (name, floor price, trading volume, etc.) as well as key statistical data. These comprehensive statistics offer a holistic view of a NFT project's market performance and activity level.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mwjq2bjkvkmuuah93b6z.png)

4/ Collection Statistics:  /sol/statistics/collection/{collection}
This interface primarily provides an overview of data analysis for an NFT Collection. It includes details such as project name, logo, total number of items, total number of holders, 24-hour lowest price, 24-hour average price, 24-hour sales, historical highest price, 24-hour trading volume, and total historical trading volume. Here, we are querying data information for Okay Bears:  You can refer to the NFTScan Collection at:  https://solana.nftscan.com/result/Okay%20Bears

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i4kxdcbyqmvx4twu32yq.png)

**Build relevant API requests**

Once developers find the required Solana API endpoints and parameters in the NFTScan API documentation, they can write API request code using their chosen programming language. Here are some general steps, along with an example illustrating how to write Solana API request code using Python:

Find the Required API: Start by locating the API documentation for NFTScan. Then, identify the Solana-related API interfaces and parameter information you need.

Choose a Programming Language: Based on your preference, select a programming language to write the API request code. Languages like Python, JavaScript, Java, and others can be used to make API requests. If you're using Python, make sure to install the requests library to send HTTP requests effectively.

Write API Request Code: Use your chosen programming language to write code that constructs the API request. Below is a Python example assuming you've found a specific Solana API interface and parameters:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kskhrzop6owdl0m09pfi.png)

In the example above, developers need to replace `api_base_url`, `solana_endpoint`, and `params` with the interface data information found in the API documentation. The provided code is a basic example, and actual NFT API requests may require more error handling and data processing, depending on the specific requirements and use cases of the API.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qx86jgde8du6cpaspd0f.png)

**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 18 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