docs/content/guides/suiplay0x1/wallet-integration.mdx
You have several options for what wallet you develop for on the SuiPlay0X1. There are some concepts to keep in mind when deciding which wallets to target.
With self-custodial wallets, users control their private keys and own their assets directly. Users that already own a wallet are typically familiar with wallet functionality and seed phrase security and storage. For users new to Web3, you must guide them through the process of obtaining a wallet and educating them on proper seed phrase management.
With self-custodial wallets, the usual payment flow has users pay their own gas fees, which reduces your costs but requires users to fund their wallets to pay for transactions. You can change this flow through the use of sponsored transactions where you pay gas fees on behalf of your users. This can reduce friction for users (especially new-to-Web3 users) because you can make the wallet onboarding experience considerably less involved for users. You must consider the long-term financial impact for your project, however, and make sure the sponsored transactions you offer are sustainable for your goals.
Self-custodial wallets have the most portability in terms of being able to interact with other applications on chain.
zkLogin wallets are a unique wallet type to Sui. These wallets provide familiar login methods from Web2 authorization providers (such as Google, Facebook, or Twitch OAuth). The user authenticates with their chosen provider, then zkLogin attaches on-chain wallet credentials to that account.
The zkLogin wallet uses an ephemeral key pair that does not correlate user metadata from authorization providers to on-chain wallets. Ephemeral key pairs are kept on the client side, making zkLogin wallets self-custodial. This eliminates the need for your users to write down seed phrases or otherwise securely store private keys.
In their simplest form, zkLogin wallets are siloed to the app that creates them. Users essentially create a new wallet for each application that supports zkLogin. This model is intentional to prevent users from having to remember passports for each wallet instance, and to match their expectations for Web2. If your intent is to keep your users in your game without the need to connect their wallet to another application, the simple zkLogin is a good choice.
Enoki by Mysten Labs is a SaaS solution that allows you to access zkLogin, sponsored transactions, and more using an API key for a monthly fiat subscription. Use Enoki for zkLogin functionality enables Enoki Connect access. Enoki Connect enables portability for your embedded zkLogin wallet where other applications can choose to allow users to connect via your game wallet. See the Enoki Connect documentation for more details.
The Playtron wallet is a type of zkLogin wallet that offers a few unique features:
A companion web application is in development to support linking the Playtron wallet to other self-custody wallets using SuiLink, enabling read-access of associated wallets while on the device.
With custodial wallets, you manage wallets on behalf of your users. The experience is similar to traditional gaming databases, except on chain. Custodial wallets eliminate the need for a user to create or bring a wallet, or to even understand what a wallet is. This greatly reduces onboarding friction, but you still need to educate users downstream for them to actually benefit from the Web3 aspects of your game.
Custodial wallets can either be aggregated or individual. In the aggregated case, all user assets are pooled together in a single wallet, and the game uses an off-chain database to track which assets belong to which individuals. Transferring assets between players does not result in any on-chain activity, only a database update. For example, if player A sells a sword to player B, you capture the object swap in a database rather than performing an on-chain transaction.
:::info
Aggregated custodial wallets can obfuscate some on-chain metrics, which can be an issue if you want external verification of your game's on-chain activity through third parties or Sui network explorers. For example, if you launch a token for your game, potential investors can't assess how many active players your app has if your game uses an aggregated wallet.
:::
In the individual case, each user gets their own custodial wallet that you manage as the game developer. Transferring assets between players results in on-chain activity and you pay the gas fee costs.
Users can't interact with other third-party apps on chain (such as NFT marketplaces) using custodial wallets.
:::tip
Be careful when selecting a third-party custodial wallet provider as this might have downstream risks if the wallet vendor goes out of business.
:::
The best wallet to select for your app depends on the goals of your project. There is usually not a single, best solution, but some choices are better than others when weighing the tradeoffs between different approaches.
While the wallet strategy is left to you as the developer, there are some requirements for working with the SuiPlay0X1:
Games that run on the SuiPlay0X1 device must support the Playtron zkLogin wallet as the default option.
You can't require users to sign transactions off-device for gameplay while playing on the SuiPlay0X1.
There is no guarantee that players have access to their other self-custody wallets or can access a non-Playtron zkLogin wallet.
Off-device games that run on different platforms (like Windows PC) must use the Sui dApp Kit to enable cross-platform play with the same wallet.
The following strategies offer some recommendations on how to best address the relevant scenarios' needs.
Benefits
On the SuiPlay0X1 device, use the Playtron wallet as default. Off-device, users can continue with their Playtron wallet (assuming you have integrated the dApp Kit SDK).
Tradeoffs
This option is effectively a special case of the recommended approach. If your game uses a game-specific zkLogin wallet, you still need to support using the Playtron wallet on the device.
Tradeoffs
As a reminder, standard game-specific zkLogin and Enoki wallets are app-specific and non-portable. Users must transfer assets to third-party wallets to use external apps. This provides a simpler implementation, but isolated user experience.
With Enoki Connect, you can upgrade your game-specific zkLogin wallet to make it portable across the Sui ecosystem.
Use dApp Kit to support self-custody wallet (either Playtron wallet on-device or Slush wallet off-device) as your primary or default wallet option. This provides immediate ecosystem portability without requiring other apps to support you.Optionally, offer Enoki Connect as a secondary choice for users who prefer game-specific wallets or are unable to set up a self-custody wallet off-device.
:::tip
Enoki Connect is not required for SuiPlay integration. In other words, your game wallet doesn't need to use Enoki Connect unless you want the additional benefits. The Playtron wallet uses Enoki Connect, which allows it to connect to third-party apps if they enable support for the wallet.
:::
SuiLink is a Mysten Labs product that connects wallets across chains to support use cases such as cross chain wallet verification, asset ownership verification, and asset distributions across chains.
The Playtron companion wallet app utilizes this technology to enable linking wallets that could contain soulbound assets in their other Sui mnemonic or zkLogin wallets, or their Solana or Ethereum wallets. This offers an improved user experience as users won’t need to transfer over all of their assets to their Playtron wallet to get the benefits these assets attribute to them.
:::info
You can prove ownership of another wallet or asset and link it to your Playtron wallet (thereby allowing the game to read those assets), but you can't transact with these assets. For operations that require transactions to occur from the Playtron wallet, assets need to be transferred.
:::
A SuiLink connection is automatically established for SuiPlay0X1 users onboarded in the Playtron wallet app. You can query a user's SuiLink objects to validate that they own a specific asset. For more information, refer to our separate guide on using SuiLink.