APIs used:
  • Get NFT transactions for contract  

Accessing the historical transfer data of an NFT (Non-Fungible Token) allows developers to view a comprehensive and transparent record of the NFT's ownership history, including information on previous owners, sale prices, and transfer dates. With this data, developers can create various applications, including analytics tools, prediction models, and trading bots, that can assist users in making informed decisions about buying and selling NFTs. By analyzing the historical transaction data, these applications can provide valuable insights into the NFT market, such as market trends and patterns, which can help users make better decisions about their NFT investments.

Get NFT transactions for contract

GET/v1/{chainName}/tokens/{contractAddress}/nft_transactions/{tokenId}/

Commonly used to get all transactions of an NFT token. Useful for building a transaction history table or price chart.

Quick Start

Assuming you already have an API key, you can paste this into the browser to see the transactions for Bored Ape #7920 on Ethereum:

https://api.covalenthq.com/v1/eth-mainnet/tokens/0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D/nft_transactions/7920/?key=ckey_sample

Remember to replace ckey_sample with your API key.

(Est time to follow along: 2 mins)

Tutorial: How to Get All Transfer Transactions for an NFT

1

Sign Up or Sign In

Sign up for an API key if you haven’t gotten one yet.

2

Find the API Reference

Once signed up, navigate to the API Reference page. This is where you can try out all the Covalent endpoints live.

3

Find the Right NFT Endpoint

Where you see the list of API endpoints, go to CLASS A > NFT > Core rendering. The endpoint we are interested in is:

4

Construct Your API Call

To use this endpoint, we will need the contract address of the NFT collection we are interested in, the token ID of the NFT, and the name of the blockchain that the NFT collection is on. In this example, we will use Bored Ape #7920 from the Bored Ape Yacht Club collection. From Opensea or Etherscan, we can get the contract address 0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D. We also find that this collection is on Ethereum so we will use eth-mainnet as the chainName parameter. Lastly, we will input the tokenId as 7920.

5

Hit Run

Once you’ve specified the parameters, hit Run. The API will return a JSON response of all the transactions for that particular NFT. Let’s examine the sample response below.

Sample response (1 of many transactions):

json
{
  "block_signed_at": "2022-11-09T06:47:23Z",
  "block_height": 15930784,
  "tx_hash": "0x7cc7de66a1012c4a2c09f67859301cf2f3331e200b720b9baef5b62ed3d8654e",
  "tx_offset": 17,
  "successful": true,
  "from_address": "0x19fffb371b95574df860e90b6a5b69256629b585",
  "from_address_label": null,
  "to_address": "0xf896527c49b44aab3cf22ae356fa3af8e331f280",
  "to_address_label": null,
  "value": "0",
  "value_quote": 0,
  "gas_offered": 496219,
  "gas_spent": 263421,
  "gas_price": 33241225652,
  "fees_paid": "8756436902475492",
  "gas_quote": 9.726372624573013,
  "gas_quote_rate": 1110.768310546875,
  "log_events": [
    {
      "block_signed_at": "2022-11-09T06:47:23Z",
      "block_height": 15930784,
      "tx_offset": 17,
      "log_offset": 40,
      "tx_hash": "0x7cc7de66a1012c4a2c09f67859301cf2f3331e200b720b9baef5b62ed3d8654e",
      "raw_log_topics": [
        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
        "0x000000000000000000000000f896527c49b44aab3cf22ae356fa3af8e331f280",
        "0x00000000000000000000000019fffb371b95574df860e90b6a5b69256629b585",
        "0x0000000000000000000000000000000000000000000000000000000000001ef0"
      ],
      "sender_contract_decimals": null,
      "sender_name": null,
      "sender_contract_ticker_symbol": null,
      "sender_address": "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d",
      "sender_address_label": null,
      "sender_logo_url": null,
      "raw_log_data": null,
      "decoded": {
        "name": "Transfer",
        "signature": "Transfer(indexed address from, indexed address to, indexed uint256 tokenId)",
        "params": [
          {
            "name": "from",
            "type": "address",
            "indexed": true,
            "decoded": true,
            "value": "0xf896527c49b44aab3cf22ae356fa3af8e331f280"
          },
          {
            "name": "to",
            "type": "address",
            "indexed": true,
            "decoded": true,
            "value": "0x19fffb371b95574df860e90b6a5b69256629b585"
          },
          {
            "name": "tokenId",
            "type": "uint256",
            "indexed": true,
            "decoded": true,
            "value": "7920"
          }
        ]
      }	
    },

The sample response above shows the on-chain data for one transfer of this NFT, including the decoded transaction logs. Only one transaction is displayed here due to space constraints, but if you were to try it yourself in the browser, you would notice that the response would contain all the transactions for the NFT.

In each transaction, we can see the transaction hash, type of transaction, gas fees paid, the sender and receiver address and much more.

In this case, we are looking at a Transfer of the NFT from 0xf896527c49b44aab3cf22ae356fa3af8e331f280 to 0x19fffb371b95574df860e90b6a5b69256629b585. This happened on November 9th, 2022, and the sender paid 0.0088 ETH in gas fees, equivalent to $9.73 on the day of the transaction.

We can find that information by looking at the block_signed_at, fees_paid and gas_quote fields in the response. Understand that all these values are denominated in wei, meaning they must be divided by 10^18 to convert to ETH value.

E.g.:

8756436902475492/(10^18)= 0.0088

The gas_quote tells us the value in USD (by default) of the fees paid at the time of the transaction. In this case, $9.73.

info
Note: we can see a slight difference in USD value between Covalent’s response and Etherscan due to differences in price granularity.

Common Use Cases

NFT transaction data can be used for a variety of purposes, including:

  1. Transaction history analysis: Analyzing the buying and selling patterns of a particular NFT or group of NFTs.

  2. Authenticity verification: Verifying that an NFT is genuine and has not been tampered with.

  3. Market analysis: Monitoring the value of NFTs over time and observing trends.

  4. Tax reporting: If you sell an NFT, you may need to file the proceeds as capital gains.

  5. Intellectual property protection: By using NFTs to represent digital assets, creators can track and protect their creations from unauthorized use and distribution.

Overall, there are many exciting ways to use NFT transaction data, and Covalent makes it easy to start!

Check out our other NFT endpoints to get NFT metadata, traits, attributes, check ownership and more!