Crafting
To learn more about crafting on a technical level, please see our in-depth crafting guide. Or, to jump straight into technical coding instructions, navigate to our designated crafting tutorial.
Immutable’s Multicaller Contract Preset has been enhanced to support crafting, with features like atomicity and compatibility with Immutable Passport to retain player immersion. Game studios can now burn, transfer, update and mint tokens in a single transaction, using our signature-based system that ties off-chain crafting recipes to on-chain transactions.
What is crafting?
Crafting encourages exploration and creativity, as players seek resources to combine and upgrade into rarer assets. Immutable’s Multicaller Contract Preset allows game studios to implement crafting with the following features:
- Atomicity ensures transactions are executed in full, or not at all, to prevent partial outcomes that may result in the loss of assets. For example, in a simple craft like burn wood + burn feather = mint arrow, if only the wood burned but the other transactions failed, a player just lost their wood NFTs.
- Retain player immersion by pre-approving crafting transactions and suppressing in-game confirmation popups for Passport users.
- Enriched confirmations in Passport to enhance crafting transaction detail for when confirmation popups are preferred.
How does crafting work?
Crafting on Immutable is built with a signature-based system that ties recipes defined off-chain to transactions executed on-chain. Recipes are the ingredients and rules that determine a crafting outcome e.g. burn wood + burn feather = mint arrow. This means only game-approved crafting recipes can be carried out since a signature is required for each transaction.
Immutable’s crafting solution comes with a Signing API which enables the ability to generate a secure signature for the signature-based system described above. This system works across one or more token contracts (ERC20, ERC721 and ERC1155) and is done using the secure and common method of EIP-712 hashing and signing.
Immutable does not have access to the keys generated from our Key Management System (KMS), however should studios wish to integrate their own Signing API, they may do so as well.
Why use crafting?
Most games require crafting in some form or another but unfortunately, implementing a crafting solution has traditionally been a complex, time-consuming journey as there are a variety of ways to achieve it. Game studios have requested an easy to implement solution and best practice guide for implementing crafting on Immutable. Immutable’s battle-tested crafting solution saves game studios significant R&D and development effort on achieving transaction atomicity, whilst also offering platform-wide compatibility such as with Immutable Passport.
Benefits
Immutable’s crafting solution benefits are highlighted below:
- Atomicity is ensured to prevent asset loss.
- Game studios can choose between retaining player immersion by suppressing in-game transaction confirmation popups or enriching confirmations with more detail.
- Since approvals are needed to manipulate player’s assets, Game Studios get the flexibility to choose between “Approve All” and “Approve Single Asset” workflows for transaction confirmations.
- Signature-based crafting allows players to submit the crafting transaction securely.
- Game studios have the flexibility of using Immutable’s signing solution or building their own.
- Game studios can dynamically and quickly update crafting recipes as recipes are stored off-chain.
Limitations
A majority of game studios will find the Immutable crafting solution to be more than sufficient for their use cases. There are two key features that are currently not supported but will be added in a future iteration:
- On-chain recipe management
- On-chain randomisation
Our solution currently assumes crafting recipes are defined off-chain and then tied to transactions via a signature. Whilst studios can extend our Multicaller Contract Preset to suit their needs, Immutable does not offer on-chain recipe management out of the box.
In addition to this, game studios should be across the following security considerations when implementing Immutable’s crafting solution:
- The central authority needs to generate a list of function calls to be executed and gets a valid signature for those calls. If this is compromised, attackers are able to generate valid signatures to mint new tokens for themselves.
- The multicall signer generates a valid signature using an EOA with a multicall Signer Role. If compromised, attackers are able to generate valid signatures to mint new tokens for themselves.
How do I implement crafting?
First, read our crafting guide to get a technical and in-depth understanding of how crafting works and the different options for implementation in your game.
Once you understand how crafting will work in your game, navigate to our crafting tutorial which is part of Immutable's Build a game series. This tutorial will provide an example of performing crafting using the Immutable Multicaller Contract Preset (with code examples).