Trace the history of a specific NFT
As the popularity of non-fungible tokens (NFTs) continues to surge, it becomes increasingly important for creators, collectors, and traders to monitor the transaction history of individual NFTs. This guide introduces you to the operation of obtaining all transactions for a specific NFT, providing a detailed overview of its transfer, trading, and ownership history. By leveraging this functionality, you can gain insights into the provenance and value of an NFT, assess its authenticity, and make informed decisions about buying, selling, or holding it. Ultimately, this operation enables you to navigate the dynamic NFT market with confidence and manage your digital assets more effectively.
Use the TatumSDK (
@tatumio/tatum
) to get a transaction history of the NFT.TypeScript
JavaScript
curl
1
// yarn add @tatumio/tatum
2
import {TatumSDK, Network, Ethereum, ResponseDto, NftTransaction} from '@tatumio/tatum'
3
4
const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
5
6
const txs: ResponseDto<NftTransaction[]> = await tatum.nft.getAllNftTransactions({
7
tokenId: '14721',
8
tokenAddress: '0xccb9d89e0f77df3618eec9f6bf899be3b5561a89', // replace with your collection
9
})
10
11
console.log(txs.data)
1
// Install with: npm install @tatumio/tatum
2
const { TatumSDK, Network } = require("@tatumio/tatum");
3
4
(async () => {
5
try {
6
const tatum = await TatumSDK.init({ network: Network.ETHEREUM });
7
const txs = await tatum.nft.getAllNftTransactions({
8
tokenId: '14721',
9
tokenAddress: '0xccb9d89e0f77df3618eec9f6bf899be3b5561a89', // replace with your collection
10
});
11
console.log(txs.data);
12
} catch (error) {
13
console.error("Error fetching wallet balance:", error);
14
}
15
})();
1
curl --location --request GET 'https://api.tatum.io/v4/data/transactions?tokenAddress=0xccb9d89e0f77df3618eec9f6bf899be3b5561a89&tokenId=14721&chain=ethereum'
[
{
"chain": "ethereum-mainnet",
"hash": "0xbbac7d1a2196c5148958bcf4ef05658f8220ca3f0ce1ff6ae9e87f67b9c940c5",
"address": "0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d",
"blockNumber": 14568283,
"transactionIndex": 34,
"transactionType": "nft",
"transactionSubtype": "incoming",
"amount": "1",
"timestamp": 1649733396000,
"tokenId": "14721",
"tokenAddress": "0xccb9d89e0f77df3618eec9f6bf899be3b5561a89",
"counterAddress": "0x0000000000000000000000000000000000000000"
},
{
"chain": "ethereum-mainnet",
"hash": "0xbbac7d1a2196c5148958bcf4ef05658f8220ca3f0ce1ff6ae9e87f67b9c940c5",
"address": "0x0000000000000000000000000000000000000000",
"blockNumber": 14568283,
"transactionIndex": 34,
"transactionType": "nft",
"transactionSubtype": "outgoing",
"amount": "-1",
"timestamp": 1649733396000,
"tokenId": "14721",
"tokenAddress": "0xccb9d89e0f77df3618eec9f6bf899be3b5561a89",
"counterAddress": "0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d"
}
]
1
interface GetAllNftTransactionsQuery {
2
/**
3
* Token ID
4
*/
5
tokenId: string
6
/**
7
* Token contract address
8
*/
9
tokenAddress: string
10
/**
11
* Optional transaction type. If not specified, both incoming and outgoing transactions are returned.
12
*/
13
transactionType?: 'incoming' | 'outgoing'
14
/**
15
* Optional from block. If not specified, all transactions are returned from the beginning of the blockchain.
16
*/
17
fromBlock?: number
18
/**
19
* Optional to block. If not specified, all transactions are returned up till now.
20
*/
21
toBlock?: number
22
/**
23
* Optional page size. If not specified, the default page size is used, which is 10.
24
*/
25
pageSize?: number
26
/**
27
* Optional page number. If not specified, the first page is returned.
28
*/
29
page?: number
30
}
1
interface ResponseDto<T> {
2
/**
3
* Actual payload of the response
4
*/
5
data: T
6
/**
7
* Status of the response
8
*/
9
status: Status
10
/**
11
* In case of ERROR status, this field contains the error message and detailed description
12
*/
13
error?: ErrorWithMessage
14
}
15
16
interface NftTransaction {
17
/**
18
* Blockchain network
19
*/
20
chain: string
21
/**
22
* Block number
23
*/
24
blockNumber: number
25
/**
26
* Transaction hash
27
*/
28
hash: string
29
/**
30
* Transaction type
31
*/
32
transactionType: 'incoming' | 'outgoing' | 'zero-transfer'
33
/**
34
* Index of the transaction in the block
35
*/
36
transactionIndex: number
37
/**
38
* Address of the token collection
39
*/
40
tokenAddress: string
41
/**
42
* Token ID
43
*/
44
tokenId: string
45
/**
46
* Amount transferred. For outgoing transactions, it's a negative number. For zero-transfer transactions, it's always 0. For incoming transactions, it's a positive number.
47
*/
48
amount: string
49
/**
50
* Transaction timestamp - UTC millis
51
*/
52
timestamp: number
53
/**
54
* Address, on which transaction occurred. This is receiver address for incoming transactions and sender address for outgoing transactions.
55
*/
56
address: string
57
/**
58
* Counter address of the transaction. This is sender address for incoming transactions on `address` and receiver address for outgoing transactions on `address`.
59
*/
60
counterAddress: string
61
}
Network | Support |
---|---|
Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai | NFTs (BAYC,...)
ERC-1155 Tokens |
Last modified 8d ago