Cointime

Download App
iOS & Android

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

Validated Project

Starknet is an unlicensed Layer 2 network developed by the Israeli software company StarkWare. Operating as a ZK Rollup on Ethereum, Starknet assists dApps in utilizing STARK proofs to achieve larger computational scale at lower transaction costs. This network enables smart contracts to interact with other contracts deployed on the blockchain, thereby enhancing composability between protocols. Starknet is among the top four Layer 2 solutions in 2023 alongside Arbitrum, Optimism (OP Mainnet), and zkSync, garnering significant popularity.

According to data from NFTScan as of December 1st, on the Starknet network, there have been a total of 15,009,965 NFT assets minted, 18,111 NFT collections, 17,009,163 transaction records generated, interactions from 2,468,080 wallet addresses, and a total transaction volume of 3,245.43 ETH.

Starknet NFTScan:https://starknet.nftscan.com/

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 on 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. 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 21 blockchains including Ethereum, Solana, BNBChain, Bitcoin, TON, Polygon, zkSync, Aptos, Linea, Base, Avalanche, Arbitrum, Optimism, Starknet, Scroll, Viction,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.

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

2/ Tansactions 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 Starknet 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.

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.

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

We retrieve details of a single NFT item under a contract address using the 'Get single NFT' endpoint: '/v2/assets/{contract_address}/{token_id}' The path parameters include contract_address/token_id for selection. In this case, we are querying an NFT with the address 0x0727a63f78ee3f1bd18f78009067411ab369c31dece1ae22e16f567906409905, named Starkpunks, and having the token ID 1.

Clicking "Try it" resulted in a data response. There are a total of 30 items under this address. The returned data includes:

1)The queried NFT token ID is 1, representing a 1% share within the project. It follows the ERC721 protocol standard. Information includes the Mint wallet address/current holder's address, timestamp when the NFT was minted, Mint's hash address and price, as well as the Token URI address. The 'latest_trade_price' (last traded price)/'latest_trade_symbol' (currency of the last traded price), 'latest_trade_timestamp' (timestamp of the last trade) currently display as null, with returned values empty, indicating that this project has not undergone any transactions.

2)Metadata: From this project's metadata, it is evident that the Metadata data is hosted on IPFS in image/png format.

3)Rarity: Description of attributes, rarity score, and rarity ranking.

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 to 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 utilize the 'Get transactions by NFT' endpoint '/v2/transactions/{contract_address}/{token_id}' to retrieve transaction records for a specific NFT item. The query parameters allow selection of transactional NFT event types (Mint/Transfer/Sale/Burn) using ';' to separate multiple events.Similarly, we are retrieving an NFT from Starkpunks with token ID 1. By specifying the Mint&Sale event types, the response data includes all key information related to this NFT transaction, such as transaction hash, From and To addresses, block details, gas consumption, transaction timestamp, and other fundamental data pertinent to Mint&Sale NFT transaction events.

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, through the 'Get NFT collections by ranking' endpoint '/v2/collections/rankings', we retrieve the NFT Collection Ranking list on the Starknet network. The query parameters for retrieval include:volume/sales/average_price/floor_price/volume_change/average_price_change, etc. Here, we opt to retrieve using the 'volume_total' field, resulting in a total return of 100 data points, with each data point containing 35 items.

4/ Collection Statistics

  • 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, through the 'Collection Statistics' endpoint '/v2/statistics/collection/{contract_address}', primarily, it returns an analytical overview of an NFT Collection. You can refer to the Starknet on-chain Starkpunks data overview:

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 are typically used to obtain various data analysis and statistical information on the NFTScan Avalanche-C 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: https://starknet.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 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)

Calling the NFT API from NFTScan is incredibly straightforward for developers. It only requires a few steps: first, navigate through the comprehensive documentation to find the required API, understand its request method, parameters, etc. Next, select a familiar programming language such as JavaScript, Python, or Java, and import the language's request library. Then, following the documentation, construct the request by configuring the API endpoint, method, and request parameters. Finally, utilize the language's library to send the request, receive, and process the returned data in JSON format. With a simple reference to the documentation, developers can complete the calling process without delving into complex technical details. The exceptionally low entry barrier makes accessing NFT data incredibly easy.

Here, we request the details of an NFT Item with token ID 1 under the Starkpunks contract address, using the 'Get single NFT' endpoint '/v2/assets/{contract_address}/{token_id}'. The retrieval address is 0x0727a63f78ee3f1bd18f78009067411ab369c31dece1ae22e16f567906409905, and an HTTP GET request is made to access the NFTScan API endpoint. To achieve this using Python's requests library, you can construct the request as follows:

Comments

All Comments

Recommended for you

  • Investment Banks Warn of Increased Selling Pressure on Hong Kong Stocks

    On July 6, several new stocks were listed in Hong Kong over the past year, and with the gradual lifting of lock-up periods, an unprecedented wave of unlocks is expected to hit the market. Brokers believe this may add selling pressure to an already struggling Hong Kong stock market. Zhizhu (2513.HK) will have 25.6 million shares ending a six-month lock-up period on Wednesday, accounting for nearly 6% of its total issued shares. The stock price has risen over 12 times since its listing. Xiyu Technology (MiniMax) (0100.HK) and Tianshu Zhixin (9903.HK) will also see lock-up shares released this week, with 45% and 4.3% of their total issued shares unlocked, respectively. Morgan Stanley's report indicates that selling pressure in the secondary market will mainly concentrate in July and September. Even if the company's fundamentals remain robust, these unlock events may pose a liquidity challenge for the market; this is one of the key reasons for the bank's cautious stance on the Hong Kong market in the short term. Goldman Sachs previously estimated that $274 billion (approximately HKD 2.14 trillion) worth of lock-up shares will be released in the Hong Kong market over the next 12 months, marking a historical high. Based on historical experience, related stocks typically see a decline of 4% to 7% in price within 3 to 6 months after the lock-up period ends. The impressive returns from new stocks may further intensify profit-taking pressure. According to EY data, the average first-day gain for Hong Kong IPOs in the first half of this year was 61%, while the overall market performance has been relatively sluggish. The Hang Seng Index has dropped 8.9% year-to-date.

  • Ministry of Foreign Affairs: Chinese Navy Conducts Submarine-Launched Strategic Missile Test, Not Aimed at Any Specific Country or Target

    On July 6, according to CCTV, Foreign Ministry spokesperson Mao Ning hosted a regular press conference. In response to a question regarding the successful organization of a submarine-launched strategic missile test by the Chinese Navy, Mao Ning stated that China has already released information on this matter and suggested that further details be sought from the relevant authorities. I can tell you that this is a routine arrangement for China's annual military training, in accordance with international law and practices, and it is not aimed at any specific country or target.

  • First Global Dialogue on AI Governance Held in Geneva

    On July 6, local time, the first Global Dialogue on AI Governance was held in Geneva, Switzerland, with approximately 1,500 representatives from around the world participating in discussions on AI governance over the two-day conference. UN Secretary-General António Guterres stated at the opening ceremony that artificial intelligence is developing at an astonishing pace. The question is whether we will steer it together or let it steer us. This dialogue provides every country with an opportunity to participate in global AI governance for the first time. We must now translate global participation into global action to make AI safer, fairer, more accessible, and more ethical. The dialogue will focus on four key priorities: the opportunities and impacts of AI; capacity building and the gaps in the AI field; safe and trustworthy AI; and human rights and human oversight. (CCTV News)

  • UBS Raises DRAM and NAND Price Forecasts for the Tenth Consecutive Month, Kioxia Target Price Increased to 144,000 Yen

    On July 6, UBS released a research report indicating that due to the ongoing tight supply and demand in the memory market, it has raised its price forecasts for DRAM and NAND for the tenth consecutive month. The price forecast for the quarter ending in September has been adjusted from a quarter-on-quarter increase of 16% to 32%, while the forecast for the quarter ending in December has been raised from a 10% increase to 12%. Consequently, UBS has revised Kioxia Holdings' operating profit forecast for the fiscal year 2027 from 7.71 trillion yen to 9.18 trillion yen, and for fiscal year 2028 from 10.9 trillion yen to 12.9 trillion yen. UBS noted that whether Kioxia can secure a five-year contract has become a market focus, and it is expected that future market attention will shift to the progress of negotiations for long-term agreements. Given the extremely tight supply and demand situation, UBS believes the outlook is positive and has raised the target price from 132,000 yen to 144,000 yen, maintaining a 'Buy' rating.

  • Vance: U.S. Opposes New Offensive by Ukrainian Forces

    On July 6, according to Sputnik News, U.S. Vice President Vance stated in an interview that Washington opposes a new offensive by Ukrainian forces and insists that they should adopt defensive tactics. Vance said, 'The Trump administration tends to believe that while we are negotiating, the Ukrainians should maximize their defensive efforts.'

  • Shanghai and Shenzhen Stock Markets Exceed 3 Trillion Yuan in Trading Volume for 16 Consecutive Days

    On July 6, the trading volume of the Shanghai and Shenzhen stock markets exceeded 3 trillion yuan for the 16th consecutive trading day.

  • South Korean President: Accelerate Three Major Projects in Semiconductor, Physical AI, and AI Data Centers

    On July 6, South Korean President Lee Jae-myung chaired a joint meeting at the Blue House to advance the three major super projects: semiconductors, physical artificial intelligence (AI), and AI data centers. He stated that the key to these projects lies in winning the 'speed battle.' Lee emphasized that competition in advanced industries is crucial for the fate of nations, and the ultimate outcome depends on who acts faster. He mentioned that the government should proactively eliminate various obstacles that businesses may encounter during investment and project development, ensuring that administrative approval processes do not delay investments and project implementation. Lee also announced that the Blue House will quickly establish specialized working groups for the three major projects, and the government will make every effort to provide support. Currently, the semiconductor industry is generating significant unexpected tax revenue, and the government will fully leverage this financial capacity to ensure support for project construction in all aspects, including fiscal assistance.

  • Tencent Releases Open Source Version of Hy3.0: Apache 2.0 License Reduces Export Restrictions, Halves Hallucination Rate

    On July 6, Tencent officially released the 295B parameter version of the Hy3.0 (Hybrid Expert Model) MoE. The most significant change is the switch to the permissive Apache 2.0 open-source license, which removes the previous regional restrictions that prohibited use in the EU, UK, and South Korea. When the preview version was released in April, many overseas or multinational teams were deterred by strict regional limitations and the commercial threshold of 100 million monthly active users. The official version has eliminated all compliance barriers and made substantial optimizations to address deployment challenges: it integrates fast and slow thinking mechanisms and incorporates a 3.8B parameter Multi-Token Prediction (MTP) layer for parallel generation, effectively reducing inference latency. Through fine-grained data cleaning and training constraints, the official version has reduced the hallucination rate of the large model from 12.5% to 5.4%, and the error rate in multi-turn interaction tests has dropped from 17.4% to 7.9%. To address the persistent issue of tool invocation inaccuracies during agent development, Hy3.0 has also undergone targeted enhancements. Whether in mainstream frameworks like Cline or CodeBuddy, the accuracy fluctuations of cross-framework tool calls have been kept under 4%, resulting in more stable outputs. The officially released FP8 quantization version has also lowered the memory requirements for local deployment and fine-tuning.

  • BTC Surpasses $63,000

    Market data shows that BTC has surpassed $63,000, currently priced at $63,014.63, with a 24-hour decline narrowing to 0.67%. Due to significant market fluctuations, please ensure proper risk management.

  • Michael Saylor Releases New Bitcoin Tracker Information

    On July 5, Strategy founder Michael Saylor released new information regarding the Bitcoin Tracker. He stated, 'Bitcoin is digital energy.' Following previous patterns, Strategy typically discloses information about increasing Bitcoin holdings the day after related announcements.