Thanks to the overly popular Ethereum blockchain game CryptoKitties, the ERC-721 tokens have come into the foray of the DLT world. CryptoKitties is basically a collectible card game where the players have the option to buy, sell and exchange virtual cats. What sets CryptoKitties apart from most of the other games is the fact that every digital feline is unique in its own way.
Building atop an Industry Favorite
This need for uniqueness is what led to the inception of the ERC-721 token standard, as it ensures that every collectible is different from the other. In simple terms, the basic idea behind the ERC-721 tokens is that they are non-fungible, and hence cannot be traded on a 1:1 basis like the typical ERC-20 tokens.
Looking at the bigger picture, ERC-721 tokens can find their way into numerous use-cases in real life, including antique art pieces, real estate, and rare metals, among other things.
However, the ERC-721 token standard also has its share of limitations.
As pointed out by Luke Zhang in a Medium post, Loom Network’s 100 percent on-chain collectible card game Zombie Battleground calls for a unique token standard that uses the ERC-721 tokens as the base, adding to it a layer of changes that make it mainstream-friendly.
Some of the challenges that popped up while using ERC-721 smart contracts were:
1) Need for low gas usage while transferring a large number of items:
Being a collectible card game, it makes sense to assume that there will be trades between players which involve a high quantity of collectibles. While these cards might be worth little in isolation, a bulk transfer of these could cost a lot.
2) Ability to differentiate among “classes” of items:
Remember being excited about having that Mewtwo Pokémon card during your childhood, but then you realized that unfortunately there isn’t only one Mewtwo card in the real world, unlike the Pokéworld?
A collectible card game like Zombie Battleground presents a similar story, where not every item is unique. There can be x number of copies of the same card owned by different users. It is thus imperative for the smart contract to identify that not all units of the items are different or unique in their characteristics. Instead, identical items need to be defined in the same “class.”
3) Need for compatibility with marketplaces, wallets, and existing infrastructure:
Although there is existing compatibility with wallets and markets for the majority of token standards, making changes to these standards entails sacrificing these existing compatibilities.
The below chart gives a concise state of the current token standards and their characteristics:
While breakthroughs are always good news in the world of technology, to address the immediate need, Loom Network chose to extend the ERC-721 standard instead of altogether abandoning it.
Extending ERC-721 with ERC-1178
While going through all the possible solutions to the problems associated with the ERC-721 token standard, Zombie Battleground found its ally in the ERC-1178 standard.
According to the GitHub page of ERC-1178, authored by Albert Chon, the token standard is defined as an interface for multi-class fungible tokens.
The need for such a token arose when the author tried to create different classes of ERC-721 tokens but ran into gas limits from having to create each token individually and maintain them in an efficient data structure for access. As a result, it was only possible to create a total of 46 ERC-721 tokens before exhausting the entire gas amount.
The ERC-1178 standard aims to fill the gap between the ERC-20 and ERC-721 token contracts.
While the former defines all the tokens in one single class or universe, the latter creates a separate class for every single token contract, thus putting immense pressure on the underlying platform.
As mentioned on the GitHub page, the ERC-1178 token standard “proposes a new standard for creating multiple classes of tokens within one token contract.”
What Does the ERC-1178 Standard Offer?
Some of the features that make ERC-1178 standard the ideal candidate to offer multi-class items are:
1) Ease of readability and understanding due to similarity to ERC-20:
The standard is easy enough to read for any of the developers to go through it. Developers can also audit the smart contract and observe what coding has been put into it.
2) No excessive coding:
ERC1178 smart contracts involve just the bare minimum to enable the desired features. Minimal bloat ensures better security for the token standard, as there is not much difference from the battle-tested code.
3) Utility beyond gaming:
As pointed out by Albert Chon on GitHub, the ERC-1178 token standard offers use cases beyond gaming. These include the ability to distinguish between common, preferred, and restricted shares of a company.
Using the ERC-1178 token standard as the base, the Loom community added a thin layer of features to make the standard ready for crypto-collectible purposes. Finally, an ERC-721 compatibility layer was added to wrap everything up – leading to the ERC-721x standard.
Use of the ERC721x Token Standard
The ERC-721x is immediately usable with any ERC-721-compatible wallet, marketplace, or service.
As a real-world use case, a user can browse for a Zombie Battleground card in Trust Wallet and readily transfer it to another user. The receiver can then check the status of the transfer on Etherscan, and then send it to OpenSea or RareBits to resell it.
Subsequently, services that support the enhanced ERC-721x features can immediately implement the gas savings in the background without any need for the end user to go through any of the technical details.
For example, users can transfer hundreds of cards for the price of one using the Loom Trading Post and can make use of transactions that are entirely free by storing the collectibles on PlasmaChain.
The very essence of the distributed ledger technology (DLT) is to bring a higher degree of transparency and efficiency into existing mechanisms. Such an aim should not burden the existing players in the ecosystem with its intricate technicalities either.
The ERC-721x token standard successfully keeps in mind the arguments mentioned above. Services offered must be open, interoperable, and compatible. Loading an existing service or product with a million features will hardly be beneficial if the end user has no access to use or view it.
While the ERC-721x smart contracts offer its users the ability to readily exchange crypto collectibles of different classes, at the same time it does not add any nuisance or burden for existing users. The transition process is as seamless as possible. For interested readers, the ERC-721x is open source on the Loom Network GitHub.