DEV Community

Cover image for How to Develop Web3 Applications on the Ethereum Network Using NFTScan NFT API
NFT Research
NFT Research

Posted on

How to Develop Web3 Applications on the Ethereum Network Using NFTScan NFT API

Ethereum is a decentralized, open-source public blockchain platform with smart contract functionality. It operates on a network of computers from around the world, following a set of rules known as the Ethereum protocol. The Ethereum network serves as a foundation where anyone can build and use communities, applications, organizations, and digital assets. Ether (ETH) is the native cryptocurrency of Ethereum. As of now, Ether is the second-largest cryptocurrency by market capitalization, second only to Bitcoin. Ethereum is currently the most widely used blockchain.

Currently, the Ethereum NFT ecosystem is in a phase of rapid growth. According to data from NFTScan as of October 31st, the Ethereum network has seen a cumulative issuance of 150,931,372 NFT assets, 275,120 NFT collections, 262,341,455 transaction records, 11,049,076 unique wallet addresses, and a total trading volume of 34,293,393.13 ETH.

For more information on Ethereum NFTs, you can visit Ethereum NFTScan at: Ethereum NFTScan.

Image description

With the API provided by NFTScan, developers can efficiently and automatically access and process vast amounts of NFT data without the need for manual operations or complex decision-making, significantly reducing development costs. Compared to developing a monitoring system from scratch, using NFTScan's standardized API for direct implementation not only eliminates the need for intricate design and development but also reduces maintenance and upgrade costs. The API facilitates high-frequency monitoring, lowering labor costs. Furthermore, NFTScan's API returns data in a standardized format, making the development and optimization of monitoring tools more straightforward and efficient. Customizable parameter settings also allow developers to tailor solutions to their specific needs.

Accessing the NFTScan NFT API

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

Image description

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.

Image description

In the API documentation, developers can find multiple interface modes to choose from based on their requirements. Additionally, 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 Ethereum 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 API services are dedicated to helping developers improve their experience in obtaining NFT data analysis.

Currently, NFTScan has the largest and most comprehensive NFT Collection database on the web, supporting full NFT data for 19 blockchains including Ethereum, Solana, BNBChain, Bitcoin, TON, Polygon, zkSync, Aptos, Linea, Base, Avalanche, Arbitrum, Optimism, Scroll, Fantom, Moonbeam, PlatON, Cronos, and Gnosis. The covered NFT data is extensive and diverse, providing a complete set of interfaces to obtain ERC721 and ERC1155 assets as well as transaction, project, and market statistics information. NFTScan now supports more than 60 public interfaces for EVM-compatible chains and a group of equivalent interfaces for Solana, Aptos, Bitcoin, and TON, largely meeting developers’ needs for indexing various types of NFT data.

Image description

Ethereum 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.

1/ 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 Ethereum blockchain to gain comprehensive insights and construct relevant applications. The "Assets" object provides unique identification for digital assets and data about their entire lifecycle, serving as a foundation for developers to understand and utilize NFTs.

The core data model in the NFTScan Ethereum API is "Assets," which represents each unique digital item. It includes comprehensive data such as token_id, collection name, tx_hash, block number, mint price, owner, and more.

2/ 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 Ethereum ecosystem. NFTScan continuously aggregates 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.

Through the Transactions API, users can access complete transaction records, behaviors, and current ownership information for any NFT asset, enabling comprehensive tracking of NFTs. This data source offers developers reliable insights into analyzing NFT transaction characteristics, price trends, circulation paths, and more.

3/ 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.

NFTScan continually tracks emerging NFT projects, swiftly acquiring their off-chain data publicly available on various trading platforms. Through the Collections API, developers can access key information about a project's off-chain description, ownership, transaction activities, and more, without the need to aggregate data from different platforms individually, making integration into applications more efficient.

Image description

Ethereum NFT API Retrieval

1/ Retrieve Assets Series

  • Get NFTs by account (Retrieve NFTs by wallet address)
  • Get all NFTs by account (Retrieve all NFTs associated with a wallet address, grouped by contract address. If the account owns more than 2000 NFTs, the returned NFTs will be limited to 2000 or fewer. In such cases, developers and users can retrieve all NFTs owned by the account by making paginated requests.)
  • Get minted NFTs by account (Retrieve NFTs minted by the specified wallet address)
  • Get NFTs by contract (Retrieve NFTs by contract address and sort them by token_id in ascending order)
  • Get single NFT (Retrieve a single NFT)
  • Get multiple NFTs (Retrieve multiple NFTs from various contract addresses)
  • Search NFTs (This interface returns a list of NFT assets by applying search filters in the request body. Assets are sorted in ascending order by nftscan_id. Note: When filtering data using only the block_number condition, the range between block_number_start and block_number_end should not exceed 10,000.)
  • Get NFTs by attributes (This interface returns a set of NFTs belonging to NFT 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 an account, grouped by contract addresses)

Here, we retrieve NFTs using the "Get NFTs by account" interface for a specific wallet address: /v2/account/own/{account_address}. In this case, we are querying the NFTs owned by the wallet address: 0xca1257ade6f4fa6c6834fdc42e030be6c0f5a813.
Clicking "Try it" provides the data response, which shows a total of 359 items associated with this address. These items are grouped in intervals of 100. The response includes basic information about the ownership of some top-tier NFT collections. This indicates that the specified address is a significant holder of BAYC series NFTs.

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 with search filters applied in the request body)
  • Get transactions by to address (This interface returns a list of NFT transactions filtered by transaction parameters)
  • Get transactions by hash (This interface returns transaction records queried by transaction hash)

Here, we use the "Get transactions by contract" interface to retrieve transaction records for a specific address. The query parameters can specify NFT event types (Mint/Transfer/Sale/Burn), separated by ';'. In this case, we filter for Mint event types. After providing your API key, the response data includes key transaction details such as transaction hash, block information, from and to addresses, contract address, transaction timestamp, and other basic data. It also provides specific information about the NFT transaction, including token ID, transaction amount, and currency, giving insight into the characteristics of the NFT transaction.

Image description

3/ Retrieve Collections Series

  • Get an NFT collection (Retrieve details based on the Collection's contract address, including an overview and categorization of items by description, owner distribution, average price, floor price, and basic summary information)
  • Search NFT collections (This interface returns information about Collection lists with search filters applied in the request body. Collections are sorted in ascending order by deployment block number. Note: When filtering data using only the block_number condition, the range between block_number_start and block_number_end should not exceed 10,000.)
  • Get NFT collections by account (This interface returns a list of projects associated with a given account address. Collections are sorted in descending order by floor price.)
  • Get NFT collections by ranking (This interface returns a list of projects with the given ranking field. Collections are sorted by the specified ranking field and the given ranking direction.)

Here, we request to retrieve a complete list of NFT Collections based on a wallet address. We use the "Get NFT collections by account" interface: /v2/collections/own/{account_address}. In this case, we are querying all ERC-721 NFT Collections associated with the account address: 0xca1257ade6f4fa6c6834fdc42e030be6c0f5a813.
Clicking "Try it" provides the data response, which shows that the address holds a total of 20 NFT Collections. These collections are sorted by floor price, and the response includes basic information about the collections, such as BoredApeYachtClub, MutantApeYachtClub, BoredApeKennelClub, Otherdeed, HV-MTL, and more.

Image description

4/ Collection Statistics: Collection Analysis Series

  • Collection Statistics (This interface provides an analytical overview of NFT Collections)
  • Collection Trade Distribution (This interface primarily offers data on 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 about 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 data on blue-chip projects)
  • Collection Blue Chip List (A list of blue-chip projects associated with this collection, you can refer to NFTScan's Blue Chip Collection)
  • Collection Top Holder (Distribution of the top holders for this collection)

Here, we provide an example of retrieving data using the "Collection Trade Distribution" interface, which is accessible at /v2/statistics/collection/trade/{contract_address}. This interface primarily offers data on the trade distribution of an NFT Collection across different time periods. For more details, you can refer to NFTScan's Traded Distribution at: NFTScan Traded Distribution.

Image description

5/ Account Statistics Series

  • Account Overview Statistics (This interface provides an overview of statistical information for a given account address, see NFTScan Overview)
  • Account Holding Distribution (This interface returns statistical information about the distribution of NFT holdings for a specific account address, see NFTScan Portfolio)
  • Account Holding NFT Trending (This interface provides statistical information about the NFT holding quantity for a given account address, see NFTScan Portfolio)

6/ Analytic Statistics Series

The interfaces in this series are typically used to obtain information related to data analysis and statistics on the NFTScan Ethereum network. Interfaces like Trade Ranking, Mint Amount, and others allow developers or users to query, analyze, and retrieve statistical data related to specific datasets or metrics. They can be used for various purposes, including market analysis, trend tracking, investment decisions, and understanding the nature of specific data.
Reference: NFTScan Analytics

7/ Refresh Metadata Series and Other

Refresh Metadata: This interface allows developers or users to submit a background metadata refresh task. Once approved, this task will refresh the specified item or the entire contract's metadata. Other interfaces include returning the latest block number and information about the number of ERC721 and ERC1155 NFTs owned by a wallet address, among other details.

Building NFT API Requests

Developers can write code to call NFTScan API using different programming languages such as Python, Java, JavaScript, and more. For example, in Python, you can use the "requests" library to make API requests; in JavaScript, "axios" is a popular choice; in Java, libraries like OkHttp or Retrofit can be used. When writing code, developers need to organize the API parameters such as contract addresses, API keys, and so on, and then call the corresponding NFTScan interface to easily retrieve standardized JSON-format data.

Here's an example of using Python to make an API request to retrieve the NFT holdings of a wallet address from NFTScan, using the interface /v2/account/own/{account_address}. Make sure you have the "requests" library installed to send GET requests.

Image description

Make sure to replace "YOUR_WALLET_ADDRESS" with the actual wallet address. Afterward, you can process the NFT data based on your specific requirements. This is a basic example, and you can customize the code to handle the NFT data as needed. Additionally, ensure that you have the appropriate API key and access permissions, and perform authentication if required.

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 19 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)