Let me start by saying that I am a NFT noob so I apologize ahead of time if any of this is obvious.
I'm looking to determine how many NFTs are "hosted" on IPFS as opposed to on centralized web servers, i.e. how many of the
tokenURIs start with
https://. The post here does a great job of outlining the manual steps you can do for a specific contract address to get the
tokenURI. I'd like to be able to do this for the complete set of NFTs in an efficient way.
In my searching, I've come across a very cool project, ethereum-etl that even has a publicly available instance of Big Query with the Ethereum blockchain. Unfortunately, it doesn't look like the tokenURI is available in any of these database tables.
Is my best bet to modify the ethereum-etl or write a script that calls the Big Query instance and then use web3.js? Specifically, it looks like it is pretty feasible to get the
tokenURI from the contract address using something like:
const nftAddress = 'YOUR_ADDRESS'; const contract = new web3.eth.Contract(ERC721ABI, nftAddress); const tokenURI = await contract.methods.tokenURI(id).call();
(this is an adaptation of the code I found here)
Surely, it would take a while to run a script to do this over the complete set of NFTs, right? Is there a better way that is more out of the box?
Update: I created this sandbox which uses web3.js to get the
tokenURI for a given NFT.