AYYO's Color Key Smart Contract Puzzle

This post discusses smart contract cryptographic puzzles, Play-To-Earn video games, and hierarchical NFT ownership of Space Guilds within AYYO. It's part of our series of posts on developing AYYO, a massively multiplayer Play-To-Earn video game.

I've separated this post into two main sections:


The Economic Models of Web 3 Video Games

ryptographically Secure Smart Contract Puzzles



If you'd like to jump right to the part where we give away 144 ETH, click here.



The Economic Models of Web 3 Video Games

Non-Fungible Tokens and Online Video Games

A NFT represents a unique non-dividable token on the blockchain. It can be transferred between players. It can't be duplicated or faked. The blockchain will always have a history of the NFT's ownership until the end of time.



Massive Multiplayer online video games contain items that players may equip into their inventory. These items are usually stored on a centralized server owned and managed by the game's developers. These items could be duplicated, transferred outside of the players' control, or even updated or removed at the will of the game developers.

Utilizing NFTs and blockchain for item ownership in online video games is an exciting prospect for players and game developers. In our development and release of AYYO Color Keys, we've deeply explored the domain problem of utilizing NFTs inside an online video game. The fundamental issue around solving the domain problem is managing the role and intent the NFT represents in-game. We will get into this further in the article. First, we must establish some fundamental terms.

Game Economy Fundamentals

Before diving into the specifics of hierarchical NFTs and game economies, we must understand how a sustainable video game economy works. I've seen hundreds of NFT game projects that ignore the fundamentals of running a healthy and viable video game economy. It's astonishing how many people have purchased NFTs for some of these rug pull games.



Winners and Losers

There will always be winners and losers in any video game economy. Money does not materialize out of thin air. It is a zero-sum game. For every person who earns 1 ETH, someone else has spent 1 ETH. This is a fundamental law of economics. The blockchain doesn't magically change that.



It's essential to make a distinction here for video games. Video games are designed for fun and entertainment. Suppose you have purchased a monthly subscription for an online video game or a cosmetic item; while you might be "losing" money on these purchases, you are "winning" because you've enjoyed an activity with friends. There is a function of utility for happy gaming. Most people today play games strictly for entertainment and enjoyment, not to earn.

How Do Online Video Games Make Money?

So how does a successful online video game continue to make money to pay its development staff and server bills? That is a great question. There are basically only a few proven models:

  • Charging Monthly Subscription Fees
  • Selling Virtual Items or Land ( Directly or through In-Game Currency )
  • Event / Tournament Entry Fees
  • Auction House Fees
  • Ads

These five models are more or less the only way to make money from an online video game. The most profitable online games we've found are using a combination of monthly subscription fees and selling items. Most games require the purchase of an in-game currency to purchase items.



Players Are The Real Value

First and foremost, I will remind everyone that value does not materialize out of thin air. What value does a video game create for its stakeholders? Video games are at the top of the attention market pyramid. The value a video game provides is captivating the time and imagination of its players.

A game that offers real value creates a solid user base of fans dedicated to playing the game. The real value of a game is in its loyal fanbase dedicated to playing the game and helping expand it from the digital realm to the real world. The most valuable games transcend their genres and influence the reality of the world around them. If you don't believe me, you can watch the new Super Mario Brothers major motion film or look up the groovy fan-made "Zelda and Chill" music album on youtube.

Video Game Economic Models To Avoid

In our 2023 research on Play-To-Earn games, we've encountered a few common patterns for online game economies that should be avoided.

  • "Yield Farming" or other Finance Terminologies
  • Games that depend on making a market for an ERC20-style Token
  • Gambling and Loot Boxes
  • "Recruit two friends" style pyramid schemes

I will briefly cover each of these as a warning for others since I have witnessed all of these in the wild.



Yield Farming

Some projects offer "yield-farming" or an "intelligent investment" scenario to sustain their game economies. Suppose a video game company sells you a story; their yield-farm investment portfolio will magically generate profits, pay you, and support the game's economy. Guess what? That isn't a video game company; it's a poorly designed finance company masquerading as a video game.

Stay away from these projects. They would not waste time building a video game on top of their investment solution if they had profound investment acumen.

Games That Focus Promotion On In-Game Currency Tokens

If a video game project has an ERC20-style Token ( on any blockchain ) and expressively is pushing the price and sale of the token on the basis it will increase in value over time, you should stay away from the project.

Value does not materialize out of thin air. I've covered this aspect of Play-To-Earn before. Web3 video games should only release a publicly traded cryptocurrency after their in-game economy is well-established and proven.

Gambling and Loot Boxes

If a video game is running loot boxes that translate to real value or is running any form of gambling or lottery to sustain its economy, avoid it. This online gambling is illegal in many places and generally predatory toward its players. Don't buy loot boxes. Don't support loot boxes. If you want to gamble, you will get better odds at a casino and at least a free meal afterward.



Multi-Level Marketing and Pyramid schemes

Multi-Level Marketing and pyramid schemes disguised as video games should be self-explanatory. If the game economy features a pyramid-shaped reward structure that relies on a constant flow of new players, avoid these games at all costs.


Figuring Out The Right Play-To-Earn Game

Try to have fun with it. Play-To-Earn is still in its infancy, and most games won't get it right in their first iteration. Remember, games are supposed to be designed for enjoyment. Find a game that you will enjoy and does not have a predatory or unsustainable economic model. There is a great opportunity now for game players and developers to be the first movers in these new Web3-based Play-To-Earn game economies. Remember: The early bird gets the worm, while the late mouse gets the cheese.


How AYYO Designed A Cryptographically Secure Smart Contract Puzzle

AYYO, here is a provable fair cryptography puzzle

We wanted to jumpstart AYYO with a fun and challenging NFT mint that would engage players, provide immediate utility in-game, provide incentives to participate, and provide the prospect of long-term value for the NFTs.



Hierarchical NFT ownership of Space Guilds

We needed to design a mechanism that would translate directly into something meaningful in our game. AYYO is set in outer space. Players can fly around our solar system and visit our planets. Unique alien factions represent each planet. Since the start, we've had plans to implement player-owned Space Guilds. A Space Guild is a collection of players controlling territory and working together towards common goals.



In AYYO, anyone who holds a minted Color Key is the leader of a Space Guild. Owning one of the initial 505 Alpha Color Keys entitles the holder to ownership of a Space Guild in-game and all the benefits of managing a Guild...including getting their own personal interstellar guild dimension.

AYYO Color Keys Open Doors


Red
Red
Red

In AYYO, our Color Key NFTs literally open doors to new dimensions. Currently, corresponding color doors populated throughout the AYYOVerse are color-coded to keys. The color coding system is not one-to-one, as keys are hierarchical based on RGB color theory. The 12 primary color keys are the most powerful ( and rare ), followed by the Secondary and Tertiary colors. If players hold the correct key, they can teleport via the corresponding door to a unique and isolated game section only available to key holders.



It's a beautifully simple yet complex system.

You can read more about how AYYO Color Keys and Space Guilds work at http://ayyo.gg/keys

Solving the Puzzle for 144 ETH



Play-To-Earn is important for AYYO. We want players of our game to always have the opportunity to make actual profit from playing and enjoying the game. We also wanted to add excitement to incentivize the players for our Alpha Color Key NFT mint.

In the spirit of Play-To-Earn and competition, we have launched a cryptographic smart contract puzzle that awards over 144 ETH in payouts to those who can solve the puzzle.



How does the AYYO Colors Puzzle work?

The smart contract's source code is publicly available and verified on Etherscan. It is immutable, so the logic running the puzzle will never change. I will discuss the mechanics and techniques used here for those interested in how the AYYO Colors puzzle works at a high level and may wish to implement their own cryptographic smart puzzles.

If you'd like to know the exact details of the AYYO Color Key Puzzle, please read the flattened smart contract. Reading it backwards from bottom-to-top is recommended.

I will hold back describing the exact details of AYYO's puzzles as the game is still in progress; however, this should provide a clear picture. Again, the smart contract code is public, immutable, and verified.



Smart Contract Cryptographic NFT Puzzle Techniques

Set Solving Solutions

Each puzzle stage requires the player to hold specific pieces of the set by id and group. Once the player has completed a set, they can unlock that puzzle stage. In AYYO, we have created three groups: Primary, Secondary, and Tertiary. A player must have one color key from each group to solve the puzzle.

Non-Set Solutions

In addition to requiring players to collect an entire set to complete the puzzle, ancillary rewards can be implemented with fewer requirements or even a single piece of the set. These can be considered "side-quests" that allow some players to win without solving the more complex puzzle. In AYYO, we have a single particular non-set solution outside of the main puzzle.

Random Set Distribution

Puzzle pieces are minted at random to ensure a fair distribution amongst players. Pieces from the set are minted using the block timestamp to create pseudo-randomness. This approach is not considered a safe source of randomness as miners could manipulate a block to mint one of the rare puzzle pieces. While these miner attacks are technically possible, we have kept our reward pool small enough to make it economically unviable for miners to perform them. To ensure true safe randomness, developers could utilize a reliable on-chain randomness source like Chainlink VRF.

AYYO, Using Secret Passwords In Public

We hide secret passwords in the public contract using one-way Keccak-256 hashing to unlock parts of the puzzle. These secrets are considered cryptographically secure until they are found out, and then the first person with the decoded secret can open that part of the puzzle.

These hidden strings are controlled by the Game Master and periodically broadcasted into the live AYYO game state via secured remote bots and the AYYO Software Developer Kit. The mechanics and delivery mechanism for secret passwords can be variable. These passwords should be designed for single use or limited use, as once the secret gets out, it cannot be hidden again.

An added bonus of this feature is that we can mimic the Keccak-256 hashing logic off-chain and in-game to allow players to solve the secret password without directly interacting with the smart contract.



Allowing Players To Mint Keys For Free

For players wishing to avoid paying to mint, puzzle pieces could be unlocked for free via a secret password revealed in-game or on social media channels. We deeply considered utilizing this option to allow a limited amount of AYYO Color Key NFTs to be minted for free based on unique in-game actions.

We ultimately chose to make the secret passwords *part* of the solution to solve the puzzle and not a means to mint free pieces. YMMV here. Giving out free pieces via secret passwords could be a fun puzzle mechanic; however, it does require an additional level of game administration and trust that the Game Master will fairly distribute the secrets.

Integrated Trading and NFT Marketplace

With several players competing to solve unique sets, it can be advantageous for players to trade the NFT Color Keys with each other to complete their redeemable set. This social aspect connects players through NFT marketplaces like Opensea. Your set's complexity level and trade requirements can depend on the nature of your puzzle.




Securing The Reward Pool

To ensure there is enough ETH to pay all winners, rewards can only be redeemed after the entire set is minted. The secured reward pool increases as each NFT gets minted, ensuring all winners are paid. Once all 505 NFTs are minted, players may attempt to call into the smart contract to solve the puzzle with the required pieces and secret password to redeem their ETH reward.



Redeemed Puzzle Pieces Are Temporarily Frozen

Once the entire set has been minted and players begin redeeming their puzzles, the smart contract will temporarily freeze the transferring of NFTs previously redeemed in a winning puzzle combination. Winning pieces may only be used once to solve the same puzzle. This freeze mechanism ensures that a previously redeemed winning piece is not accidentally sold on the NFT marketplace. It's essential to consider this factor, amongst many others, to ensure the safety of your players. Once all sets are completed, the winning pieces may be transferred between players again.

Hierarchical Guild Management through NFT Ownership



Solving the puzzle and winning ETH is only the wrapping paper on the gift of the AYYO Color Key NFT itself. I personally minted the first key ( nervous that I might accidentally mint a rare piece ) and happily minted Teritary Key Number 99: Cute Crab #df4040.

In AYYO, a Space Guild's colors are represented by the hex-coded color. So now that I am the holder of the unique color: #df4040, I control the Cute Crab Space Guild. I can now manage my Guild like in any other multiplayer online game.



This is my Color Key. There are many like it, but this one is mine.


Space Guilds in AYYO, like their Keys, are hierarchical, with three levels: Primary, Secondary, and Tertiary. Each of these levels matches up to the AYYO Color Keys. There are 505 Alpha Color Keys and 505 Guilds available. You can read more about Guilds and Keys . I'm excited that I got a key that descends from Red, which means my Guild acts as a Vassal to the larger and more dominant Red Guild.

AYYO Color Key holders have real in-game utility and can travel to their Space Guild's dimension and start building their Space Guild's Base.


The Future of AYYO Color Keys

There will likely be an active market for these Alpha Color Keys in the future, as we can feature any of the 505 guilds or colors in-game with new features or content. This means a Tertiary key of a lower guild could suddenly become more valuable in the real world because a new resource, mineral deposit, or quest was found in-game in a territory controlled by that Guild.




There are countless ways we, as the game developers of AYYO can enhance and diversify the utility of the Color Keys as the game progresses and expands. The Color Key system is the base hierarchical system of ownership in AYYO. Guilds are paired with colored keys. Planets are controlled by Factions, and all Players and Guilds are Faction bound. The Cute Crab Key I minted is a descendant of the Primary Red Key. This means my Cute Crab Guild is aligned with the Draconian Empire, the current Faction which controls Red. My sworn in-game enemy is the United Earth Alliance, who hold the Blue Key.


AYYO, let's Go!


In Summary

Play-To-Earn is just beginning. As I have described, we will see numerous cryptography puzzles in the future. We will see countless blockchain-based games using NFT-like protocols to persist in-game items. The video game market has an excellent opportunity, and I look forward to the next ten years. Play-to-Earn will be a household term in the future, and many gamers will earn a daily living by playing video games.

Good luck and happy hunting for those participating in the AYYO Color Key Hunt.



Be excellent to each other.