0

The ERC721/1155 method tokenURI is a public variable and has a getter for retrieving the data itself (e.g., often returns the ipfs://Qm... CID). Let's assume the tokenURI method itself isn't emitting some sort of event when it's called since the only events that are part of the specification are Transfer, Approval, and ApprovalForAll. If it did emit an event, then one could simply parse logs for when this method is called.

So, is it possible to know how often tokenURI is called across Ethereum as a whole, or at a minimum, for a single ERC721/1155 contract? With centralized services like Infura or Etherscan, they likely have that type of data in-house, but it's not publicly accessible -- e.g., how many times tokenURI is called via API (or through the UI) across everyone that uses their respective services.

The general goal is to understand Ethereum's most used ERC721/1155 contract methods while highlighting the frequency of tokenURI reads. I wasn't able to find this exact type of information on Dune.xyz nor The Graph, so I'm curious if I'm just unaware of how straightforward this is...or it's just not possible due to no events being logged.

1 Answer 1

0

You cannot determine this actually. And if you do choose to emit events in the tokenURI function it would no longer be a view i.e. it mutates the state of blockchain, since logs(events) are stored in the blockchain database and you'd require a tx to do that. Even if you do make a function that will emit events, most likely people are just going to eth_call it, no one is going to pay for reading data from blockchain. Nor should they.

Also, mutability of a function is a part of standard, so a mutable tokenURI will not really be metadata extensions compliant standard. See metadata extensions here.

In conclusion, it is not possible to get this data without a very custom RPC that will log and track the eth_calls. And even then you'd only get the data for and about the people using that RPC which will only be a subset of users. Major providers like infura, alchemy can track this to give some idea of it.

1
  • Got it, makes sense. Appreciate the detail!
    – dtb
    Apr 4, 2022 at 22:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.