Loyalty, Airdrops, and Crypto Unicorns

by zomglings, Moonstream DAO

Moonstream.to
5 min readMar 18, 2022
Image by Crypto Unicorns

At Moonstream, we take data very seriously. Our customers use Moonstream to manage their blockchain economies. It is impossible to manage such an economy without a very detailed and accurate view of what is happening in that economy and what was happening in that economy at every moment in the past.

This is why we do not rely on any third parties blockchain explorers or crawlers to provide our analytics data. We crawl our own data and, since our launch last September, Moonstream has provided data far more reliably than explorers like Etherscan and Polygonscan.

We have been working with Crypto Unicorns since the beginning (of both projects!). One way in which the Crypto Unicorns team uses our product is to power their loyalty program. The UNIM leaderboard, for example, is powered by the Moonstream API on the backend:

UNIM leaderboard

Crypto Unicorns also uses our product to launch and manage on-chain items in their economy. All Shadowcorn Eggs and lootboxes were created using Moonstream Markets. Golden Tickets and Founders Badges will follow the same pattern.

As a successful project with tens of thousands of on-chain participants, Crypto Unicorns is in the top tier of blockchain games. One of the challenges of operating at this scale is that it becomes very difficult to run operations like airdrops, which involve submitting thousands of transactions to the blockchain to distribute rewards to the community.

Crypto Unicorns and Moonstream have been working together to distribute UNIM and RBW through airdrops. The ERC20 interface wasn’t built with such large scale operations in mind, so it has taken quite a bit of additional technical and operational work in order to make the airdrops even remotely manageable.

One of our early decisions with UNIM was to use the EIP2535 Diamond proxy standard, even though it is simply an ERC20. This made it easy to add functionality to the contract at a later date. For UNIM airdrops, since the token has variable supply and can be minted or burned, we added batch minting functionality to the contract. We also wrote a bot which submits the airdrop transactions and handles checkpointing so that it can replay failed airdrop transactions and ensure that everyone gets the UNIM they are entitled to as part of the loyalty program.

The solution we used for UNIM airdrops does not generalize to any ERC20 token, however, and it is important to us that anyone be able to use our platform to manage their loyalty programs and reward distribution. Without our direct involvement.

To that end, we have been working on a product called Moonstream Lootbox. Moonstream Lootbox allows projects like Crypto Unicorns to bundle multiple rewards into a single EIP1155 token, a Lootbox. These Lootboxes can be distributed at scale to community members, who then go through a claims flow to open their Lootboxes and receive their rewards.

Yesterday’s RBW airdrop was the first time Moonstream Lootboxes were used in production on a mainnet. Here is the explanation from the Crypto Unicorns claiming guide that shows how it works:

Claim tokens screen
You will only see the RBW token pack that you are qualified for. Click the Claim RBW button on that pack.

It was also the most complex airdrop we have ever been part of and involved dropping various different amounts of tokens to over 14,000 addresses.

There were a few complications with the drop:

lootbox drop issues on Open Sea

The first issue, which didn’t come up as we were testing earlier this week on the public testnet, was that there were addresses on the recipient list which represented smart contracts that could not safely receive EIP1155 tokens. Our bot batches addresses to send rewards to, so this meant that any batch of rewards that contained such an address would just end up with a failed transaction.

The second issue was that we implemented an unintuitive error recovery flow. Our bot stores checkpoints of all transactions that succeeded and failed, and is able to recover from failures. But the operator has to recompile the list of rewards after each failure to continue with the drop. Requiring recompilation was a bad idea as, in the heat of the moment, I forgot to recompile the rewards list after hitting our first failure (due to the first issue). This led to us dropping twice the requisite number of x50 RBW Lootboxes to all recipients and twice the requisite number of x100 RBW Lootboxes to some of the recipients.

The third issue was that the tokens were immediately transferable, and people started trading/transferring them on Open Sea as soon as they appeared in their profiles. In future drops, we plan to designate the Lootboxes as non-transferable until we are sure that the drop was done correctly. Only then will we enable transfers.

Once we realized what the problem was (longest 5 minutes of my life), we decided with the Crypto Unicorns team to deprecate the erroneous Lootboxes and do a second deployment of Lootboxes from scratch.

The second airdrop also experienced some failed transactions due to the first issue, but we dropped the vast majority of Lootboxes yesterday and will follow up and fix the erroneous transactions next week. We also plan to do something about the “No Entry” tokens next week, but we will work with the Crypto Unicorns team and community to determine the best course of action.

Overall, we dropped Lootboxes to tens of thousands of people yesterday in slightly more than a hundred transactions. In the past 12 hours, over 5,000 Lootboxes have been opened. Despite the issues, the first production operation of Moonstream Lootbox was a success.

We will continue to build and improve on the Lootbox experience. Any feedback you have would be of great help to us in doing so. The best place to speak with us is Moonstream Discord. Hope to see you there.

--

--

Moonstream.to

Build, Scale, and Monitor Your Game’s Economy. Moonstream provides economic infrastructure for web3 games.