How to Get the Current Owner of an NFT
Displaying the current owner of an NFT is fundamental to the functionality of most NFT applications, whether they are marketplaces, galleries, or platforms showcasing digital assets. The unique aspect of NFTs lies in their ownership being transparently and immutably tracked on the blockchain, making it possible to verify who holds an asset at any given time.
This guide walks you through leveraging the GoldRush API to retrieve and display the owner of an NFT.
Prerequisites
Before starting, ensure you have:
Node.js installed on your computer.
An API key from GoldRush, which you can obtain on the GoldRush website.
Tutorial: Getting the Current Owner of an NFT
1
Setup
2
Understand the Endpoint
/v1/{chainName}/nft/{contractAddress}/metadata/{tokenId}/
Parameters:
- chainName: The blockchain network (e.g.,
eth-mainnet
). - contractAddress: The smart contract address hosting the NFT collection.
- tokenId: The unique identifier for the NFT within its collection.
Query Params (Optional):
- no-metadata: If present, the response will omit metadata.
- with-uncached: Set to
true
to fetch metadata from upstream servers if not cached.
3
Fetching NFT Ownership
"Your_Covalent_API_Key"
, "nft_contract_address_here"
, and "nft_token_id_here"
with your actual GoldRush API key, the contract address of the NFT, and the token ID you're interested in, respectively.4
Understanding the Response
current_owner
field.nft_data: {
token_id: "940",
token_url: "<https://ipfs.io/ipfs/QmarGRwVKPaCe2s5QSSTMEdbYDwKxFz6bAn58YZPPcWc7k/940>",
original_owner: null,
current_owner: "0xd2ce458c449727e628944cc2ff25386205ba6f7f",
external_data: {
name: "Invisible Friends #940",
description: "5,000 animated Invisible Friends hiding in the metaverse. A collection by Markus Magnusson & Random Character Collective.",
asset_url: "<https://nftassets.covalenthq.com/aaed746920ac10d789eedcba6d334448473cdf6dc3ed1719601d6d90c25ca0d5.gif>",
asset_file_extension: "gif",
asset_mime_type: "image/gif",
asset_size_bytes: "1313101",
image: "<https://nftassets.covalenthq.com/aaed746920ac10d789eedcba6d334448473cdf6dc3ed1719601d6d90c25ca0d5.gif>",
image_256: "<https://nftassets.covalenthq.com/cdn-cgi/image/width=256,fit/aaed746920ac10d789eedcba6d334448473cdf6dc3ed1719601d6d90c25ca0d5.gif>",
image_512: "<https://nftassets.covalenthq.com/cdn-cgi/image/width=512,fit/aaed746920ac10d789eedcba6d334448473cdf6dc3ed1719601d6d90c25ca0d5.gif>",
image_1024: "<https://nftassets.covalenthq.com/cdn-cgi/image/width=1024,fit/aaed746920ac10d789eedcba6d334448473cdf6dc3ed1719601d6d90c25ca0d5.gif>",
Conclusion
From marketplaces and galleries to platforms showcasing digital art and collectibles, the transparency and immutable tracking of ownership on the blockchain make NFTs uniquely secure and verifiable. This guide has equipped you with the knowledge and tools to leverage the GoldRush API for retrieving and displaying the owner of an NFT. Happy building!