Skip to content

How we went from 0 to millions in transaction volume with one fully on-chain game

Act I of Crypto Unicorns: The Dark Forest — a fully on-chain game that ran before the main Crypto Unicorns game launch. What started as an experiment, became one of if not the most successful fully on-chain game. It was also one of the first fully on-chain games, before they rose in popularity. Now some even might say that fully on-chain games are the future of web3 gaming. 

The game had a huge impact on the Crypto Unicorns community with over 92% of all unicorns being staked into the Dark Forest at least once. It marked the birth of the first Crypto Unicorns’ antagonists — Shadowcorns. 

Overnight, the Dark Forest contract built by Moonstream came to represent great economic value. Crypto Unicorns: The Dark Forest has expanded the frontiers of possibility in web3 gaming.

To better understand the scope of the Dark Forest game, here are some numbers. During the two-month run of the game there were 368,126 transactions, 798,948 smart contract events and 1,574,017 token transfers, including UNIM and ERC721 token transfers. Considering that 200m UNIM tokens were distributed by the contract, adding to that the value of Unicorns staked and Shadowcorn eggs rewarded, at its peak the Dark Forest smart contract held over $100m in value.

How it worked

Before Crypto Unicorns launched their game, they needed something to keep players engaged. And so Crypto Unicorns: The Dark Forest was born out of a collaboration between Moonstream and Laguna Games.

The Dark Forest contract address is 0x8d528e98A69FE27b11bb02Ac264516c4818C3942. You can find its code on Polygonscan.

The game provided utility for player NFTs, and proved to be a very successful faucet and sink for the CU game token (UNIM). It was a fun thing to do while waiting for the launch and a fun twist on the usual staking rewards.

People staked their Unicorns into the Dark Forest smart contract with the idea of exploring the Forest to gather Unicorn Milk (UNIM). Every 24 hours, the Unicorns could come back with Unicorn milk from the Dark Forest. Players could sacrifice Unicorn Milk on the sacrificial altar at the entrance to the Dark Forest. This would give them a chance of receiving a Shadowcorn egg or a lootbox as a reward for their sacrifice.

Those are two game mechanics that were supported by Moonstream’s technology and Laguna Games’ UI and lore: staking and sacrificing.

People jumped at the opportunity to craft their own narratives around these pretty simple mechanics. Crypto Unicorns formed a very supportive and active community around their game. Staking and unstaking were not automated, and players banded together around the time their Unicorns would emerge from the Forest and would need to be staked again. 

YGG wrote smart contracts to manage staking and unstaking large numbers of unicorns at once. Making a game fully on-chain makes this kind of extensibility easier for players. Moonstream released an open source bot that some players used to automate their exploration of the Dark Forest:

Some players created strategies around farming the Unicorn milk. Did it make sense to get more lootboxes by sacrificing less milk or was it better to hoard more milk for a chance to get a Shadowcorn egg? 

More aspects for players to consider were: Unicorn Milk would become useful by itself for breeding and evolving unicorns later on in the game. On the other hand, lootboxes could contain useful items, and Shadowcorn eggs granted a bonus to the Unicorn Milk earned when Unicorns exited the Dark Forest.

Some players even tried to game the system by staking their Unicorns before the Dark Forest game started and by finding reward randomness exploits. More on that next.

Problems and solutions

During the run of the Dark Forest, we encountered a problem. A Crypto Unicorns community member reported an exploit. Someone had figured out how to exploit the smart contract reward randomness. 

Here’s how the randomness worked: after initiating UNIM sacrifice at the altar, the Dark Forest requested randomness from Chainlink. It stored this randomness in smart contract state until the player completed their sacrifice. Then used the randomness to decide which reward to drop.

However, players could potentially inspect the randomness in state and wait for favorable conditions to earn mythic or rare Shadowcorn eggs. The only caveat was that they had to wait hours to profit.

Within 30 minutes of the exploit being reported, the Moonstream team created a bot that sniped any attempt to use it. Using monitoring through the Moonstream API, we nixed any sacrifice that was taking a suspiciously long time. 

This experience led to us developing tools for providing security that can be used in any web3 game or economy to protect its value.

The mechanics

Let’s talk a bit more about the mechanics or the main feedback loops created for the Dark Forest by Moonstream. Our mechanics are implemented to be mounted as facets on EIP-2535 Diamond proxy contracts.

All of the game items, badges, and lootboxes are represented on-chain with Moonstream’s Terminus protocol

Staking or Exploration mechanic. NFT characters receive a reward for “exploring” an area for a certain amount of time. The reward can be ERC20 tokens, achievements, experience points, on-chain lootboxes, etc.

The Dark Forest contract implements the ERC721TokenReceiver interface. Players send their Unicorns to explore the Dark Forest with a safeTransferFrom transaction and transferring ownership of the Unicorns to the Dark Forest. 

We also added requirements to be checked against for successful staking: Unicorns should be adults and should not be already staked in the main game.

Unicorns do not automatically exit from the Dark Forest. An exitForest transaction needs to be submitted.

Sacrifice mechanic. Players can sacrifice an ERC20 token to get a chance at winning a prize. Prizes can be any ERC20 or ERC1155 token (e.g. badges, lootboxes, etc.)

Sacrifices created immediate utility for UNIM even before the Crypto Unicorns game launch. Players could decide whether immediate rewards (lootboxes, Shadowcorn eggs) were more valuable to them than the later use of UNIM for Unicorn breeding.

What’s next

Moonstream always operates on the cutting edge of blockchain technology for gaming. We see potential in certain tools and mechanisms for games and we prove our theories in action.

We are now working on refining our tools to be used to provide utility and support any gaming economies. We are also working on our own fully on-chain games.

Do not underestimate what Moonstream can do for your game. Follow our progress. Use our tools. Be among the first to succeed.