Cointime

Download App
iOS & Android

🔑 Guide: How to Develop Web3 Dapps on Bitcoin Using Ordinals API

Validated Project

With the rise of Ordinals in the NFT ecosystem, the Bitcoin network has experienced an unexpected transformation, significantly increasing the frequency and activity of transactions on the chain. As more and more users and developers enter this ecosystem, the transaction volume and miner revenue on the Bitcoin network have significantly increased, driving technological progress and market development in the entire blockchain industry. The rise of Ordinals highlights the NFT market's potential and reveals new possibilities for Bitcoin in the decentralized digital asset space.

According to data from NFTScan, as of June 28, 72,389,094 Ordinals inscriptions (NFT assets) have been minted on the Bitcoin network, generating a total of 524,774,887 on-chain interaction records. 2,630,322 wallet addresses have interacted, with a total transaction volume of 73,192.92 BTC and a current market value of 8,868.51 BTC.

Ordinals NFTScan: https://btc.nftscan.com/

Before using the NFTScan API, you need to visit the developer platform and create an account. Visit the NFTScan official website and click on the “Sign Up” button for NFTScan API registration.

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

Sign up

Once logged in, find your unique API KEY on the Dashboard. Visit the API documentation, enter your API KEY in the appropriate place as instructed in the documentation, and you can start using the API service. In the API documentation, developers can find various interface modes based on their needs.

In the Dashboard, developers can also view statistics on their API usage, helping to track historical usage data. Additionally, NFTScan provides each registered developer with 1M CU of API call services for requesting all NFT API interfaces, and the CU never expires until used up!

After successfully registering a developer account and obtaining an API Key, you need to review the NFTScan API documentation. The API documentation contains detailed information on all available API endpoints and parameters, as well as how to construct requests and handle responses. Please read the API documentation carefully and make sure you understand how to use the API to retrieve the data you need. NFTScan API services are dedicated to helping developers improve their NFT data analysis experience.

NFTScan currently boasts the largest and most comprehensive NFT Collection library on the web, supporting full NFT data for Ethereum, Solana, BNBChain, Bitcoin, Mint, and 24 other blockchain networks. The NFT data covers a wide range of assets and types, providing a complete set of interfaces to access ERC721, ERC1155, ERC404, and ERC6551 assets, as well as transaction, project, and market statistics. The platform currently supports over 60 public interfaces for EVM-compatible chains and a set of similar interfaces for Solana, Aptos, Bitcoin, and TON, greatly meeting the needs of developers to index various types of NFT data.

The main components of the Ordinals API model include three key interfaces, each providing information on core fields that developers can utilize to access data and serve their DApp services. This overview aims to help developers understand how to retrieve data and make use of it in their projects.

Assets API: “Assets” are the most crucial data fields in NFT, used to uniquely identify and describe digital assets. By extracting the “Assets” data from NFTs on the blockchain, developers can gain comprehensive insights and build related applications. The “Assets” object provides a unique identifier for digital assets and data on their entire lifecycle, serving as the foundation for developers to understand and apply NFTs.

Transactions API: The transaction model represents the complete transaction data of an NFT asset on the blockchain, providing developers with information on the full lifecycle transactions of NFTs. This includes NFT minting, transfers, sales, and other transaction activities, enabling developers to gain a deeper understanding of the flow and evolution of Ordinals in the Bitcoin ecosystem. NFTScan continuously aggregates NFT transaction market data and related transaction contract information from various blockchain networks, providing valuable insights for tracking and understanding the dynamics of the NFT market. It also helps developers in building NFT-based applications and tools.

Collections API: NFTScan gathers off-chain data related to NFT collections, including descriptions, social media, and other basic information. This data is obtained through APIs provided by the most mainstream NFT markets on various blockchain networks. Additionally, floor price information is based on centralized data from NFT market order information, which can also be accessed through APIs.

  • Get NFTs by account (Retrieve NFTs by wallet address)
  • Get minted NFTs by account (Retrieve minted NFTs by wallet address)
  • Get NFTs by collection (Retrieve NFTs by collection name and sort by inscription_id in ascending order)
  • Get single NFT (Retrieve a single NFT)
  • Get NFTs by output (Retrieve NFTs by output)

Get cursed inscriptions (This endpoint retrieves a set of cursed inscription NFTs, sorted by inscription_number in ascending order)

Here we can use the “Get cursed inscriptions” endpoint “/btc/assets/cursed/inscription” to retrieve details of a set of cursed inscription NFTs. Query parameters include cursor, limit, and show_attribute for selection. Some inscriptions that have been successfully engraved do not have an allocated index and therefore cannot be retrieved, hence they are referred to as “cursed inscriptions”. NFTScan also integrates and indexes this data for the convenience of developers.

  • Get transactions by account (This API returns a list of NFT transactions for a wallet address)
  • Get transactions by inscription ID (This API mainly retrieves BTC NFT transactions by Inscription ID)
  • Get transactions by collection (This API returns a list of transactions for a specific collection, sorted in descending order by timestamp)
  • Search transactions (This API returns a list of Ordinals transactions applying search filters in the request body)

Here, we will use the Get transactions by inscription ID interface with the path: “/btc/transactions/{inscription_id}”, to retrieve transaction records for inscription ID 6fb976ab49dcec017f1e201e84395983204ae1a7c2abf7ced0a85d692e442799i0. The query parameter fields available for selection include event_type (transaction event type): Mint/Transfer, separated by ‘;’ for multiple events.

  • Get an NFT collection (Retrieve details based on Collection name)
  • Search NFT collections (This endpoint returns information about collection lists by applying search filters in the request body. Collections are sorted in ascending order by create_block_number)

We retrieve the details of an NFT collection named “Bitcoin Frogs” through the API Get an NFT collection “//btc/collections/{collection}”:

Once you have found the required Ordinals API interface and parameters in the NFTScan API documentation, developers can write API request code using their chosen programming language, set the API endpoint and request parameters, and use an HTTP request library to send the request and handle the API response data. For example, in Python, you can use the requests library to send a GET request, set the API endpoint and request headers, and configure the request parameters as needed, and finally handle and print the response data.

Here, we will use the “Get an NFT collection “//btc/collections/{collection}” to retrieve details of a collection named Bitcoin Frogs. We will make an HTTP GET request to access NFTScan’s API interface. Using Python’s requests library, you can construct the request like this:

import requests# Set the API endpoint and Collection namecollection_name = "Bitcoin Frogs"api_url = f"https://api.nftscan.com/v1/btc/collections/{collection_name}"# Set the request headersheaders = { "Authorization": "Bearer YOUR_API_KEY", # Replace YOUR_API_KEY with your actual API key "Content-Type": "application/json"}# Send the GET requestresponse = requests.get(api_url, headers=headers)# Handle the response dataif response.status_code == 200: data = response.json() print("API Response Data:", data)else: print("Request failed with status code:", response.status_code)

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

Comments

All Comments

Recommended for you

  • Putin: Russia "supports" Harris, calls her smile "contagious"

    According to foreign media such as TASS and Russia's Sputnik News, Jinse Finance reported that on the afternoon of September 5th local time, Russian President Putin said at the plenary session of the Eastern Economic Forum 2024 that Russia will "support" the US Democratic Party presidential candidate and vice president Harris as recommended by the US President Biden in the upcoming US presidential election. When asked how he viewed the 2024 US election, Putin said it was the choice of the American people. The new US president will be elected by the American people, and Russia will respect the choice of the American people. Putin also said that just as Biden suggested his supporters to support Harris, "we will do the same, we will support her." The report said that Putin also joked that Harris' laughter is "expressive and infectious," which shows that "she is doing everything well." He added that this may mean that she will avoid further sanctions against Russia.

  • An ETH whale repurchased 5,153 ETH with 12.23 million USDT 20 minutes ago

    A certain high-frequency trading ETH whale monitored by on-chain analyst Yu Jin bought 5,153 ETH with 12.23 million USDT 20 minutes ago.

  • CFTC: Uniswap Labs has actively cooperated with the investigation and only needs to pay a fine of US$175,000

    The CFTC has filed a lawsuit against Uniswap Labs and reached a settlement. It was found that Uniswap Labs illegally provided leveraged or margined retail commodity transactions of digital assets through a decentralized digital asset trading protocol. Uniswap Labs was required to pay a civil penalty of $175,000 and cease violations of the Commodity Exchange Act (CEA). The CFTC acknowledged that Uniswap Labs actively cooperated with law enforcement agencies in the investigation and reduced the civil penalty.

  • Federal Reserve Beige Book: Respondents generally expect economic activity to remain stable or improve

    The Federal Reserve's Beige Book pointed out that economic activity in three regions has slightly increased, while the number of regions reporting flat or declining economic activity has increased from five in the previous quarter to nine in this quarter. Overall employment levels remain stable, although some reports indicate that companies are only filling necessary positions, reducing working hours and shifts, or reducing overall employment levels through natural attrition. However, reports of layoffs are still rare. Generally speaking, wage growth is moderate, and the growth rate of labor input costs and sales prices ranges from slight to moderate. Consumer spending has declined in most regions, while in the previous reporting period, consumer spending remained stable overall.

  • Puffpaw Completes $6 Million Seed Round with Lemniscap Ventures as Participant

    Puffpaw has announced the completion of a $6 million seed round of financing, with participation from Lemniscap Ventures. The Puffpaw project plans to launch a blockchain-enabled electronic cigarette aimed at helping users reduce nicotine intake through token incentives. The project encourages users to quit smoking by recording their smoking habits and rewarding them with tokens. Puffpaw's token economics aims to cover 30% of the cost of users' first month of using their product and provide social rewards. The project also considers possible system abuse, but the issue of users potentially reporting smoking habits dishonestly is not yet clear.

  • Affected by Ethervista and others, Ethereum Gas temporarily rose to 33gwei

    According to Etherscan, due to the influence of contracts such as Ethervista, Ethereum Gas has temporarily risen to 33gwei, with the top three being EthervistaRouter, UniswapRouter, and BananaGun.

  • The probability of the Fed cutting interest rates by 25 basis points in September is 55%.

    The probability of the Federal Reserve cutting interest rates by 25 basis points in September is 55.0%, while the probability of a 50 basis point cut is 45.0%. The probability of the Federal Reserve cutting interest rates by a cumulative 50 basis points by November is 32.1%, by 75 basis points is 49.2%, and by 100 basis points is 18.8%.

  • Nvidia: No subpoena received from the US Department of Justice

    Nvidia (NVDA.O) stated that it has not received a subpoena from the US Department of Justice.

  • US SEC again postpones decision on environmentally friendly Bitcoin ETF listing application

    The US Securities and Exchange Commission (SEC) has once again postponed its final decision on the New York Stock Exchange (NYSE) Arca's application for a carbon offset Bitcoin ETF. According to a document dated September 4th, the decision has been extended to November 21st. The ETF aims to provide a Bitcoin investment exposure in an environmentally friendly way by offsetting carbon emissions, tracking an investment portfolio composed of 80% Bitcoin and 20% carbon credit futures. Tidal Investments submitted the fund registration application in December 2023, while NYSE Arca submitted the initial application in March. Concerns have been raised about the environmental impact of Bitcoin mining, with the International Monetary Fund (IMF) reporting that cryptocurrency mining accounts for 1% of global greenhouse gas emissions. The delay in this decision also includes the postponement of approval for the Nasdaq One-Stop Cryptocurrency Investment Portfolio ETF.

  • Pudgy Penguins CEO:何为消费级加密货币应用

    加密货币行业中的一些 builder 努力地重复造轮。如今,一些突破性的消费级产品,若是能基于区块链打造并利用好加密货币的激励机制,其规模可能是现在的 10 倍。与其试图重新创建一种模式,不如利用现有的模式进行加密化改造。我认为,许多尚未面世的消费级加密货币应用在 Web2 中都有对应的产品,它们正等待着通过加密货币释放巨大的增长潜力。