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

NFTScan
10 min readDec 30, 2023

--

Gnosis Chain is an EVM-compatible blockchain that focuses on fast and low-cost transaction capabilities, using a unique dual-token model; xDai is a stablecoin used for trading, payments and transaction fees, with PoS protection provided by GNO through the consensus layer Gnosis Beacon Chain, Gnosis Chain has many features, including EVM compatibility, low fees, fast transaction confirmation, etc.

According to NFTScan data, as of December 29, a total of 11,664,269 NFT assets have been issued on the Gnosis network, with 34,920 NFT Collections, 2,186,102,311 interaction records generated, 127,182,491 addresses with interactions, and a total trading volume of 464,199.51 xDAI.

Gnosis NFTScan: https://gnosis.nftscan.com/

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

Sign up for NFTScan Developer

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

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

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

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.

Gnosis 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 NFTs associated with a wallet address using the ‘Get minted NFTs by account’ interface: ‘/v2/account/mint/{account_address}’. The query parameters include the protocol standards: erc721/erc1155, we’re querying the address: ‘0xe6704d29aecb2498a41a62e343341683049a5dc0’ for all erc1155 protocol-based NFTs on the Gnosis Chain.

Upon clicking “Try it,” the data retrieved includes basic information queries for the NFT asset contract address, metadata information, rarity scores, and rankings. Here, we can see that under the address 0xe6704d29aecb2498a41a62e343341683049a5dc0 on the Gnosis blockchain, there is a total of 1 ERC1155 NFT contract address: 0xc831ed2b521feee75f7e9e7ed755874a0e70faad, along with its basic data information.

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)

Here, we use the ‘Get transactions by contract’ interface ‘/v2/transactions/{contract_address}’ to retrieve the transaction records for a specific NFT item. The query parameters allow selecting NFT event types (Mint/Transfer/Sale/Burn), separated by ‘;’.

For example, we can search for the NFT transaction records of the POAP address 0x22c1f6050e56d2876009903609a2cc3fef83b415, by selecting the “Mint” event type. The response data will include all the important data for every item that is minted under this NFT collection. This will include transaction hash, From and To addresses, block information, gas consumed, transaction timestamps, and other basic data characteristic information for NFT transactions.

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, using the ‘Get an NFT collection’ interface ‘/v2/collections/{contract_address}, by specifying the contract address 0x22c1f6050e56d2876009903609a2cc3fef83b415, we can retrieve the specific details of the POAP.

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)

We can use the ‘Collection Trade Distribution’ interface “v2/statistics/collection/trade/{contract_address}” to obtain the trade distribution data of an NFT collection. The resulting output format is similar to that of “NFTScan Traded Distribution”:

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://gnosis.nftscan.com/analytics

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 locate the required Gnosis API interface and parameters in the NFTScan API documentation, they can utilize their preferred programming language, such as Python, Java, JavaScript, etc., to write code for making API requests. Here’s an example demonstrating how to use Python to request trade records for an NFT contract address:

We use the contract address:

0x22c1f6050e56d2876009903609a2cc3fef83b415

and the NFT interface:

“/v2/assets/{contract_address}”

to retrieve all NFTs in that NFT Collection.

import requests

# Define the base URL and contract address for NFTScan API
base_url = "https://api.nftscan.com/"
contract_address = "0x22c1f6050e56d2876009903609a2cc3fef83b415"

# Define the API endpoint
endpoint = f"/v2/assets/{contract_address}"

# Additional parameters can be added as needed
params = {
# Additional parameters if required
# "param_name": "param_value"
}

# Enter your NFTScan API key
api_key = "YOUR_API_KEY"

# Construct the request headers
headers = {
"Accept": "application/json",
"Authorization": f"Api-Key {api_key}"
}

# Send the GET request
response = requests.get(base_url + endpoint, headers=headers, params=params)

# Check if the request was successful
if response.status_code == 200:
# Parse the response content
data = response.json()
# Process the returned data for further operations
print(data) # Process data according to the response structure
else:
print(f"Error: {response.status_code} - {response.text}")

Please note that this is a simple example, and developers may need to adapt and enhance the code based on their specific requirements and the documentation of the NFTScan API. Also, ensure that you have obtained a valid API key before making API requests and provide accurate parameter values according to your actual scenario.

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

Join the NFTScan Connect Program

--

--

Responses (1)