0

Does a site like Cryptokitties query the blockchain in order to verify which ERC-721 tokens a specific user owns upon logging into his wallet, or does it store the list of owned tokens locally in a database? I would think that the site needs to query the blockchain every time, but just wanted to confirm.

Thank you. J

2

To be specific there is no need to query the blockchain. Read operations (from view or pure functions or to read a variable's state) can be executed locally in your local node as they don't modify the contract's state. So the query is never sent to the blockchain and the result is immediate.

Otherwise both options are possible but my guess is that it simply reads from the node so there's no need for double book keeping.

  • Thank you Lauri. What if one does not deploy a local node? (Hosting the front-end app on a shared hosted server for instance) In this case, going to the Ethereum Network wouldn't be efficient, right? However, what if one sells a token on another site, such as opensea for instance, the local database wouldn't be updated. – JF0001 Jan 1 at 20:08
  • 1
    You have to use some node to connect to the blockchain - whether hosted by you or some service provider. So whatever node you use you can use the same node to read data without accessing the actual blockchain. And your front-end hosting place is probably not relevant here, the node is in the backend. And as for selling tokens on another site - that's one more reason why there's no need to use an extra database – Lauri Peltonen Jan 1 at 20:19
  • Thank you again for your time Lauri. Understood that the front-end wasn't relevant here, but just wanted to emphasize that I wouldn't be deploying a node on my end. I now understand what you meant by local node. J – JF0001 Jan 1 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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