I've been working on the cryptozombies tutorial and now i want to go further but when trying to deploy the contract on REMIX to test it i'm having problems. I get:

transact to ZombieFeeding.feedOnKitty errored: VM error: revert. revert The transaction has been reverted to the initial state.

Note: The constructor should be payable if you send value. Debug the transaction to get more information.` error. The code is:

pragma solidity ^0.4.24;
import "./zombiefactory.sol";

contract KittyInterface {
    function getKitty(uint256 _id) external view returns (
       bool isGestating,
       bool isReady,
       uint256 cooldownIndex,
       uint256 nextActionAt,
       uint256 siringWithId,
       uint256 birthTime,
       uint256 matronId,
       uint256 sireId,
       uint256 generation,
       uint256 genes

contract ZombieFeeding is ZombieFactory {

KittyInterface kittyContract;

    modifier onlyOwnerOf(uint _zombieId) {
        require(msg.sender == zombieToOwner[_zombieId]);

    function setKittyContractAddress(address _address) external onlyOwner {
        kittyContract = KittyInterface(_address); //0x06012c8cf97bead5deae237070f9587f8e7a266d

    function _triggerCooldown(Zombie storage _zombie) internal {
        _zombie.readyTime = uint32(now + cooldownTime);

    function _isReady(Zombie storage _zombie) internal view returns (bool) {
        return (_zombie.readyTime <= now);

    function feedAndMultiply(uint _zombieId, uint _targetDna, string   _species) internal onlyOwnerOf(_zombieId) {
        Zombie storage myZombie = zombies[_zombieId];
        _targetDna = _targetDna % dnaModulus;
        uint newDna = (myZombie.dna + _targetDna) / 2;
        if (keccak256(abi.encodePacked(_species)) == keccak256("kitty")) {
            newDna = newDna - newDna % 100 + 99;
        _createZombie("NoName", newDna);

    function feedOnKitty(uint _zombieId, uint _kittyId ) public {
       uint kittyDna;// = 456127291358119496194667091109459857780766667351016867864478616867222987;
       (,,,,,,,,,kittyDna) = kittyContract.getKitty(_kittyId);
       feedAndMultiply(_zombieId, kittyDna, "kitty");

And after debugging I've noticed that if i set the kittyDna variable to something by myself instead of using the (,,,,,,,,,kittyDna) = kittyContract.getKitty(_kittyId); line then everything works. My guess is that the way i am implementing the Kitty interface is wrong? BTW I'm not using the mainnet. What i want to do is get the genes value from the cryptokitties getKitty contracts function. Thanks in advance for any help !


I suspect that the cryptokitties data is not there if you aren't using main net. Cryptokitties are only deployed to mainnet and tested on ropsten.

I suspect the cryptozombies tutorial was assuming the contract was on main net.

I think you might benefit from using revert messages, available in remix.

  • Cool! I had a suspicion that it was because I'm not on the mainnet, since this is just something for learning solidity I've decided to generate a random kittyDna. Thanks ! – Storm Kippie Oct 16 '18 at 6:28

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.