CryptoKitties Genome Mapping

By |2018-05-21T09:33:07+00:00May 4th, 2018|

If you haven’t already heard of CryptoKitties, welcome to the amazing world where ‘digital cats’ have sold for over $100 000. The interesting question I’m hoping to answer today: How do the genes of these peculiar cryptokitties combine to form new offspring? Can we visualize this in a simple manner?

Background

CryptoKitties is a blockchain-based game where users are able to buy, sell, breed and collect a number of these interesting and varying virtual cats. They are undeniably cute, and represent an incredibly clever and creative way of showcasing the power of blockchain technology.

So how do these cats actually ‘work’ and more importantly ‘breed’? I’m going to take a bit of different approach in explaining them, geared toward visualizing and understanding their actual data and representation. First though, it is helpful to understand at a very high level what a ‘blockchain’ actually is.

Think of a blockchain as a massive public list of transactions. At its simplest, a single transaction would represent a transfer of something, perhaps a bitcoin or a cryptokitty, from one person to another. Every time a bunch of new transactions occur, we add another ‘block’ to the ‘chain’ containing these new transactions. This same public list is kept and updated by lots of different parties all around the world. This makes it very difficult for one single entity to try and manipulate this transaction list and therefore ensures the integrity of the list.

Some data

Although the above explanation is oversimplified, it helps to give some context before we look at some of the JSON data below representing a ‘transaction’ that was the birth of a new cryptokitty!

If we look at the above data, we can see numerous different and interesting fields. We can see the block number in which this transaction took place. We can see that the transaction was a birth thanks to the ‘type’ field. We can see the public address of the person who owns this kitty. We also see the matron and sire Id, which is essentially the Id of the mom and dad cat. One special thing to mention from the above data is the binary string I’ve highlighted in blue that carries the genes of the kitten. It is pretty difficult to make sense of this binary string by itself and understand what ‘cattributes’ it is responsible for. Accordingly we convert this binary string into something called ‘base58’ notation for greater interpretability. This will be seen in the next visualisation.

The Visualization

The visual below presents an actual example of a Matron and Sire combining to create a new kitten. We look at the ‘DNA string’ or rather genes of each cat and map the various traits that have been passed down from the parents to the new kitten. For example it’s easily seen that all the cats below share the same eye type (raised-brow) and eye color (chestnut). You also start noticing things like the Matron and Kitten share the same pattern, whilst the Sire and Kitten share the same tail.

The visual representation of these cats is depicted purely by their DNA string, and thus as you carefully examine the DNA in the visual below, you begin to understand why these cats look like they do. Note however, only the dominant trait (the rightmost block in each quadruplet of 4 blocks) is actually visible in the visual appearance of the cat!

Again it is pretty important to emphasise that only the dominant traits actually determine the appearance of the cryptokitty. Recessive traits are essentially dormant but present a chance of being expressed in offspring. Take for example the tummy colour in the above visual. Although both parents have a cream tummy indicated by the dominant gene ‘7’, the kitten’s dominant tummy colour gene ends up being ‘5’ (granite-grey). This is since ‘5’ was a recessive trait from the parents that has ended up being expressed in the kitten.

The above cats were chosen as their simple visual characteristics make it easy to see the ‘cattributes’ the kitten has inherited from its folks. Below, for interest and even more so for fun, are some other visuals created looking at the more weird and wonderful cats and their offspring.

I suspect the cryptokitties creators made many subtle nuances that come into play when determining the genes of the newly born cryptokitty. Thus we will probably always be asking some questions of why exactly does the cat look like that!?

Mutations? Indeed! The red dot (pictured above on Ninja cats DNA string) signifies that the trait was inherited neither from the Matron or the Sire, and rather was a mutation! Hence, we now have a Ninja Cat!

Hope you’ve enjoyed examining these cryptokitties as much as I have! Please let me know if you have any interesting ideas or feedback regarding the visualizations.

Thanks to James Kilroe, Kyle Levin, Teresa Riedl, Jason Smythe and Inge Lok for all the help and feedback!

About the Author:

James Kilroe
James is one of the few leading the charge globally in token economics, a cutting edge and largely misunderstood field within the nascent blockchain industry. His token economies and writing are at the forefront of his field, he is pioneering a new way of raising capital and business models for African start-ups. Some of his recent work includes designing token economies for up to $300 million (USD) markets for local African and international start-ups paving the way to solve large social impact problems.