I'm trying to understand how crypto unique tokens are stored on the blockchain and how is it linked to a graphic of this token. In the case of cryptokitties, each kitty is generated randomly by the smart contract from my understanding. But how is each kitty's image stored on the blockchain? Or is this all controlled by a centralized server and only the smart contract generates random string data to represent a kitty?
3 Answers
I think you can learn a lot of thath making your own crypto game with cryptozombies.io they have a chapter dedicated to explain your question
Your second hypothesis is correct. The “genes” are generated on-chain and ownership etc. is also tracked there. Interpreting the raw blockchain data and turning it into a game with a UI is done in a centralized manner with a standard webserver and all that Jazz.
-
I'm curious to how are the "genes" generated in a random way. Is there a function that generates random data for this use case? Feb 21, 2018 at 16:19
-
Updated my answer to include a link about gene randomness generation. :)– lungjFeb 21, 2018 at 16:27
The images are not stored on the blockchain but the gene string is. The images produced are done via a server. A good example of this is how https://robohash.org/ works. A random string creates a new image.
The gene string is only random to an extent. Each piece of the string represents a crypto kitties characteristics...and during the birthing process, they are modified to still hold most of the characteristics of the parents. There is a function called mixGenes()
that leads to a contract called geneScience
and unfortunately, the source isn't verified.
-
thanks, that really solidified my understanding of identicons which is what cryptokitties is based off of. Feb 21, 2018 at 17:04