Arrow icon
Ness Labs: Make the most of your mind
Learn more about Joggo

A Summary of

How to code your own cryptokitties-style game on Ethereum

by
James Martin Duffy
Medium
View original

What are CryptoKitties?

It is a blockchain game on Ethereum that allows its players to purchase, sell and breed virtual cats. Each cat has a unique appearance and carries a 256-bit genome with DNA and its attributes.

How to Code CryptoKitties

The game is open source, and the code is split into smaller contracts: 1. KittyAccessControl is controlled by the CEO, CFO, and COO only and does not relate to game mechanics but the management of the contract. It is responsible for pausing/unpausing the contract and withdrawing the funds. 2. KittyBase defines the core data of the app, including data storage, constants, data types, and functions to manage these items. 3. KittyOwnership provides the methods for non-fungible token (NFT) transactions, conforming to the ERC721 token spec, allowing the developers to own arbitrary data and digital assets. 4. KittyBreeding contains methods necessary to breed cats and relies on the external combination contract, stored separately; the CEO is responsible for setting the address of this contract. 5. KittyAuctions include the methods for auctioning and bidding on cats. 6. KittyMinting contains methods to create new gen0 cats, which are “promo cats,” given away for promotional purposes to early beta testers. 7. KittyCore is the main CryptoKitties contract that ties everything together. Because of the inheritance structure of the code, it inherits all the information from the previous contracts. CryptoKitties are not entirely blockchain-based. Instead, a “kitty” comes down to a 256-bit integer, whose genetic code is interpreted on CryptoKitty’s web server – which ultimately determines what a kitty looks like.  

Related content
See all posts
Arrow icon