What’s in the genes of your CryptoKitties?
Background article for CryptoBreeder.net, a service that helps you turn your beautiful (on the inside) kitties into beautiful Ether.
CyptoKitties is a game on the Ethereum blockchain of buying, breeding and selling digital kitties. You can make money from it by skillfully breeding kitties to create new traits (Cattributes). This article explores the game’s secret inheritance and Cattribute assignment algorithm. From the findings, we created CryptoBreeder.net a webservice that uses Artificial Intelligence and Serverless Cloud Architecture to bring you -for free- super-smart and robust breeding recommendations for your crypto kitties.
What are CryptoKitties?
CryptoKitties are digital cats that can be collected, sold and even breed, where each kitty represents a unique persistent entity. However, rather than one company holding the information about each kitty, their owner and any transactions, CryptoKitties uses a public ledger, the Ethereum blockchain, to store this information. This ensures robustness as the information is distributed across many maintainers as well as provenance because once included in the blockchain the information cannot be tempered with.
As such, you need Ether, the currency of the Ethereum blockchain, to conduct any transaction, like buying and selling a cat, or breeding and putting your cat up for siring. With the developers soon launching a mobile app (Spring 2018) and aiming to accept “non-internet”currencies (FIAT, e.g. US dollars through credit cards), it is likely capturing the attention of an even larger audience.
Here, we are investigating the kitties’ genomes that make then unique, determines their visual features and ultimately dictates their value. With the results we created a webservice that helps you make informed decision when breeding your CryptoKitties: CryptoBreeder.net.
Optimize your CryptoKitties breeding strategy, get the cattributes you want & maximze Kitty's Ether returncryptobreeder.net
CyptoKitties Genes and Cattributes
The genome of every kitty consists of a Hexadecimal string of 63 positions (loci) with therefore 16 possible bases ([1–9,a-f]). The genome itself is stored on the blockchain and can be obtained using the long number from the smart contract, which you can retrieve manually using the ‘getKitty’ Query function:
Contract Source Code Copy Find Similiar Contracts pragma solidity ^0.4.11; /** * @title Ownable * @dev The Ownable…etherscan.io
A hidden algorithm (CEO) converts this genome string to a set of Cattributes, which are descriptions of how the virtual cat looks like. To get a feel for this, the cryptokitty-designer gives the option of playing around with these traits (though some recently emerge traits are yet to be added). They are grouped into 8 categories like Body, Patter, or Color.
Two cats can be breed to generate a new offspring, which holds a combination of the parents genome as well as new mutations. The below image, shows that this results in some Cattributes being passed on, while it also has the capacity to create new combination of existing Cattributes and even completely novel kitties.
Value of Cats
As some Cattributes are less often seen than others, rareness determines the price at which a kitty can be sold on the market place. A good starting point to judge the value of kitties is www.kittyexplorer.com, which also offers a Chrome extension to view estimates live on the CyryptoKitties marketplace.
Making informed Breeding choices
A lot of effort has already gone into understanding how the genome determines the Cattributes. A very valuable tool is cryptokittydex.com, which allows you to view your cat’s genome and most notably do some “genome science” on them, e.g. intersect the genome of several cats to find the common gene.
As researched by KaiGani in his Medium article and described by CryptoKitty community wiki, the genome may code for Cattributes in 12 blocks of 4x5-bit codes and this article describes a potential inheritance algorithm based on this concept. However, for now we are investigating the Hex genome straight up to understand Cattribute assignment and finding inheritance pattern in there.
How are Cattributes determined from the hex genome?
Evaluating 400,000 CryptoKitties, we found that all Cattributes have a dominant base per loci. However, while for example 100% of cottoncandy cats have the base 4 at the 41st loci, ‘only’ 99% of oldlace have a 2 at the same loci.
Fancy kitties are a little more complicated and generated by combinations of multiple loci, however they still have base preferences for loci.
This is the perfect application for Artificial Intelligence, as multiple loci together make up the Cattributes, especially for Fancy cats. At CryptoBreeder.net, we hence use Machine Learning to train a mathematical model on the full database of existing kitties. We update this database every day and retrain the model so you have access to the newly emerging Cattributes.
Machine Learning models can pick up the common Cattributes easily as they can learn from several 1000 examples, however rare or newly emerging Cattributes are underrepresented in the dataset. At CryptoBreeder.net we are hence carefully selecting the training data to teach the model how to pick up all Cattributes. E.g. today’s model was trained on 440,025 kitties and predicts 90 Cattributes including Fancy (e.g. PhuZiqaat, which emerged today) with an accuracy for new kitties (testing) of 0.94 (perfect=1.00).
Please note that there is another Machine Learning-based service (www.kitty.services), however as of today it was trained on only 100K kitties.
How are new genomes generated?
To develop an algorithm that accurately mimics the inheritance patterns observed, we investigate all trios (mom, dad, offspring) in our 400K dataset. We see that the probability of whether the offspring inherits its base from mom or data is similar (orange and blue bar have the same height). However, there is a strong variability between each loci of whether the offspring has a different base than mom or dad.
At CryptorBreeder.net we use this mutation probability to determine if the base will be inherited (50:50 mom or dad) or may mutate (new selection from the Hex alphabet).
Making the most of your kitties
You can use CryptoBreeder.net to find out whether it is worth spending Ether on breeding two specific cats. To provide you with this estimate, CryptoBreeder.net uses its sophisticated inheritance algorithm to create a litter of 100 kitties from your selected cats and then predicts of each of them the Cattributes using its super accurate Machine Learning model.
So for the above mentioned pair (#231122 and #231014) we predict the offspring to have 79% probability of being granitegrey, and indeed all of them have this cattribute listed. We also predict the probability of generating a ShipCat at around 8%.
Deployment of CryptoBreeder.net
CryptoBeeder.net is a serverless web-application built on AWS. This means it can instantaneously scale up to cater for traffic spikes. A static website in an S3 bucket is dynamically updated with the results from Lambda functions (fetching genomes, breeding, and predicting). The machine learning model is kept up to date by an EC2 instance, which is triggered daily through a CloudWatch Rule and Lambda function to fetch the most recently born kitties and re-train the machine learning model.
What we are working on next
- Improving the inheritance algorithm
- Including rareness scores so you know straight away how valuable a certain Cattribute is
- Enabling matchmaking
If you want to suggest features and get involved in the CryptoBreeder.net Project please send an email to email@example.com.