Rich metadata should be off-chain

Contract storage is the most costly operation that can be performed on Ethereum. Enjin’s philosophy is to have a “rich client” and “minimal blockchain”.

Games using ENJ-backed blockchain assets will not suffer from high gas fees, because all the metadata for items is handled by the games themselves. The blockchain only needs to maintain the smallest necessary amount of data needed to validate a player’s ownership.

Monolithic Custom Tokens contract

We were the first to pioneer the concept of a monolithic token contract, and this idea is now being used in games like CryptoKitties and their proposal for an ERC-721 standard. In our design, all tokens are stored in a single smart contract, which drastically reduces the fees associated with deploying new tokens.

Almost every ERC-20 token on Ethereum today is bloating the blockchain and making it more expensive to use, because up to 99% of token code is redundant.

Our innovative solution was to re-use all smart contract code and increment a tokenId whenever a new game item is created. The data required can be measured in bytes and the gas fee is about 10x lower than deploying a common ERC-20 token!

After new tokens are created by a game developer, transfer fees cost less than a penny, similar to ERC-20 token transfer costs.

Sometimes you need blockchain item metadata

In certain cases storing metadata for items in the blockchain is inevitable, like when a game needs to enforce some global properties. Enjin uses the LOG opcode in Ethereum to store metadata about items, which is provided to the game engine.

This results in massive savings of 78x less gas per byte (!) compared to other game platforms using Ethereum, and the ability to store a lot more metadata per item.

Collectible-trading games like CryptoKitties could be made with Enjin by appending custom event data to each token transfer as a randomization seed for any genetic mutations, and using a rich client to display the resulting “kitty”.

The result is a kitten breeding system that costs fractions of a penny, compared to the current CryptoKitties breeding cost of $6.25.

How do we ensure that each “affordable kitten” follows the game rules without enforcing these rules in the pricey EVM?

Players play the game through a game client, which is their lens into the game’s data. If all players use the official client, the items and data will be presented to them in the same way and give each player an identical experience.

In essence, we off-load parsing the game rules, parsing the state, and enforcing the logic to the off-chain code “lens”, which is the game server or game client. The game client may even be an open-source HTML application.

If a copy of the game client is modified, it becomes a new way of visualizing the game’s state, and players can choose to play the game using its unique feature-set if they wish.

You can compare this to players in the real world who agree to play a chess game with Fischer Random Chess rules instead of the orthodox chess ruleset. In a similar vein, many online multiplayer games have used “mods” for years to change the way their game behaves, and this is now a popular component of many online games.

Multi-transfers

The bulk of a token transfer cost is the base transaction fee applied to every transaction.

Our special token contract allows us to offer multi-transfer & multi-approve functions to allow multiple game items to change hands in a single transaction.

The gas cost for multi-transfers is less than broadcasting separate transactions, and it results in less network congestion.

This feature will become very useful for game servers distributing many items to one or more players — for example, each member of a group could receive a unique quest puzzle piece when they enter a dungeon together.

These items would all be processed in a single Ethereum transaction!

Future optimizations

Once the core SDK is launched, we will put our efforts into minimizing transaction costs further by experimenting with off-chain, lightning-style payment networks. We also have other innovations that will be revealed in future updates as they are built.

CryptoKittes are a proof of concept, a showcase of some of the possibilities that blockchain technology can bring to the gaming world. There’s a couple of takeaways here.

Blockchain based games are able to gain adoption rapidly. They allow game designers to innovate in previously unimaginable impossible ways, freeing and inspiring them to build epic (in CryptoKitties case, meowtastic) works of art.

But we need to take care to design games and gaming platforms to account for the unique intricacies of how blockchains function.

Enjin removes the complexity behind working with games on Ethereum, and provides a powerful set of tools for game developers of the future to build their games with.

The future’s looking bright for Enjin

The Enjin Network recently reached 19,000,000 users, up 300,000 from 18.7M in a single month. We’ll be expanding our presence into related industry events by attending a major gaming conference, an event we’re extremely excited about.

Our Smart Wallet is due to launch by the end of the year, and we’ve gone to extraordinary lengths (read — cold, hard code) to make it ultra-secure (read — more secure than any major wallet on the market) — even going so far to develop a custom keyboard for Android.

Stay tuned.