Why the New Aptos Token Object Is a Game Changer

METAPIXEL and Aptos have been working together on AIP 11 — now game assets can be dynamically and flexibly managed on-chain!

METAPIXEL
7 min readMay 24, 2023

Hello, I am Willing, and I’m leading the blockchain and platform backend development at METAPIXEL.

In this article, I’d like to talk about the Token Object recently implemented on the Aptos mainnet. There have been significant changes to the Aptos blockchain earlier this year. AIP (Aptos Improvement Proposals) 9 (Resource Groups)[1], 10 (Move Objects)[2], and 11 (Tokens as Objects)[3] were proposed to the Aptos community, addressing the challenges of data accessibility, storage efficiency, and introducing the Object model for Token creation. With the recent updates to Token Objects, dynamic data processing and composition are now possible, allowing for more diverse and flexible operations within smart contracts and dApps.

Now, let’s explore how these changes in the data model can bring about significant transformations in NFT services and how they will be integrated into our games.

In typical web2 games, data is stored and managed on each game server. This confidential and hidden information is difficult to access or distinguish from the outside. Even if characters and items are traded, it can only be done within the system, and their value is hard to validate outside of the game environment.

On the other hand, web3 games using blockchain technology allow for the identification and definition of in-game items even outside of the game, providing true ownership of digital assets (game items) acquired by users. In other words, the lifecycle of web3 assets acquired by users in the game is controlled by the users themselves, not the game server. Users can ensure the value of their time and money invested is reflected and assign true value to digital assets. This phenomenon will disrupt the status quo and create new markets.

However, from the perspective of developers like me, the value provided by web3 games and the implementation of that value are a different story. In-game digital assets (items) have the characteristic of constantly changing and evolving. Unfortunately, with existing blockchain technology, it has been difficult to capture the flexibility and dynamics that game assets possess.

METAPIXEL team during a co-working session with the Aptos Labs team in Palo Alto

To address this, we have been collaborating closely with Aptos and engaging in joint development. As a result, together we have created the Aptos standard called Token Object (AIP 11) for game asset representation and development.

In this article, we will explore what (Token) Objects are, why they are necessary, and how they can be utilized.

Token Object as a way to represent game assets

As mentioned earlier, game assets, especially game items, are typically not created and left as is. Once an item is created, it usually grows alongside the user’s character. Items can be further upgraded, changed, and their attributes are frequently modified. Additionally, items can be bound to an account or character and be untransferable between accounts or characters. To represent all these characteristics and behaviors, it is necessary to express in-game assets on the blockchain dynamically in order to convey their value.

Token v2 — Token as Object

Before the introduction of the Object model, Aptos was already capable of representing these concepts, but with some complexity and costs. The figure below illustrates how assets were represented in the Token v1 model and how they are represented in Token v2 (Token Object) after the introduction of the Object model.

One of the major changes in Token v2 is that it represents NFTs on the same level as user accounts. In Aptos, a user account is identified by a 32-byte address, and similarly, NFTs are identified by addresses on the same level. The structure and content of NFTs are defined through AIP-10 Move Object. In other words, NFTs can be accessed through a global address, similar to how token access was available through the user account, enabling more intuitive and straightforward handling of resources.

Additionally, within the Object address space, an ObjectCore resource is defined to indicate that it is an object. The owner field is used to indicate the owner of the object. This means that instead of going through complex processes to determine NFT ownership in many blockchains, one can access the object through a global address and retrieve the owner information internally.

Owners are indicated in the fields inside ObjectCore

This facilitates the implementation of object ownership over other objects (composability) in a more convenient manner.

How an object owns another object (composable NFT) User icons created by Freepik.

One advantage of Objects is their efficient use of storage space. AIP-9 Resource Groups addresses the issue of storage space wastage for Objects and describes how to use storage space efficiently. Objects, along with the previously defined ObjectCore, are grouped with other resources defined as members of aptos_framework:object::ObjectGroup and stored together in one storage.

This leads to high data locality and significantly reduces storage costs compared to previous approaches. From a development perspective, it becomes much easier to locate and acquire these resources, resulting in shorter retrieval times.

In the Aptos Token v2 model, NFTs can be considered as Token resources defined within an Object. Token resources possess the following attributes, as presented below:

Token structure in an Object model

The Token resource, which is added as an attribute of the Object, also benefits from being grouped within the aptos_framework:object::ObjectGroup, allowing it to leverage the advantages of the Object model.

Additionally, the Object model presents improvements in type-safety and data access. This enables safer and more precise development of game assets, ensuring better integrity and reliability.

Benefits for METAPIXEL users

By utilizing the Token Object model introduced earlier, game assets can be dynamically and flexibly managed on-chain. Let’s consider an example of applying the Token Object to a game. For example, game players can transparently acquire rare, powerful NFTs through the Proof of Play (PoP) system [4]. With the Token Object, this can be implemented easily. It’s worth noting that the creator ( e.g. game servers) creates the token and obtains the valid permission (construct_ref) only during creation. Using this, they acquire the permission (linear_transfer_ref) for a one-time transfer and then transfer the item to the player.

Example code of minting a game item as an NFT

The acquired NFT is displayed in the user’s wallet. In other words, upon minting, the user immediately gains ownership and control over the NFT.

Example of Token v2 (object) minting

(All resources used are examples and not representative of final implementation)

The acquired weapon can be bound to the user upon equipping. In other words, the weapon NFT can be transformed into a SoulBound Token. This functionality can be implemented within the Object using a single function called disable_ungated_transfer.

Example code of making the item soulbound

Furthermore, weapons have the capability to level up and grow. The following example illustrates a level upgrade using the property_map:

The example demonstrates the usage of a single Token object to mint game NFTs, grant Soulbound status, and upgrade attributes (Dynamic NFT). By leveraging Token objects, it becomes straightforward to implement Composable NFTs through relationships with other objects. Unlike traditional blockchain approaches that require separate standards and data models for each functionality, Token objects enable real-time minting, composition, evolution, and trading of game items.

Summary

METAPIXEL aims to provide users with the intrinsic fun of games while offering the values of web3, such as data sovereignty, immutability, and transparency. We are actively researching ways to enable seamless onboarding for a large number of users and make web3 games enjoyable and accessible for everyone.

We are at the forefront of this movement and are confident in showcasing web3 games that are distinct from the traditional gaming experience, and there’s even more on the way.

References

[1] Aptos Community, AIP-9 Resource Group

[2] Aptos Community, AIP-10 Move Objects

[3] Aptos Community, AIP-11 Tokens as Objects

[4] Lucas Ko, Why Gran Saga: Unlimited Is More than Just a Game

Official Links

METAPIXEL Website: METAPIXEL: the Complete Gaming Metaverse
METAPIXEL Discord: discord.gg/metapixel
METAPIXEL Twitter: METAPIXEL (@Metapixel) / Twitter
METAPIXEL YouTube: METAPIXEL — YouTube
NPIXEL Website: 엔픽셀 — NPIXEL

--

--

METAPIXEL

Where players become owners. The premier gaming ecosystem, bringing true web3 gaming to the world.