Skip to main content

Quickstart for MPC in Unity

Overview

Follow the steps in this guide to install and run a demo Unity app that's already integrated with the MPC Solution. Get a feel for how MPC works by generating an MPC private key for a user. After that, explore other features such as creating transactions, signing messages, and more.

Prerequisites

Before completing this quickstart, make sure you have the following:

Step 1. Run the demo app

  1. Clone the mpc-unity-examples repository with the demo Unity project:

    git clone git@github.com:axieinfinity/mpc-unity-examples.git
  2. Open the repository as a project in the Unity editor: File > Open Project.

  3. Run the demo scene: Project > Assets > Example > MPCTest > Play. run-demo-scene

Step 2. Initialize MPC

  1. In the UserId field, enter any string as the user's identifier.
  2. In the Password field, enter a recovery password—minimum 8 characters, at least one special character and at least one number.
  3. Click Initialize. enter-credentials
note

During initialization, the demo app generates a mock OAuth 2.0 access token for the user. When using MPC in a live game environment, you'll need to send a request to the Sky Mavis Account service to acquire the access token.

Step 3. Generate MPC wallet

To generate an MPC wallet, click Gen Key.

This action generates an MPC private key using the recovery password and access token. After that, the system automatically encrypts the key using the recovery password. The encrypted key is then backed up to the Sky Mavis backup server. The system uses this copy in the recovery process when the user logs in with the wallet on a device.

generate-key

The result should look like this:

key-generated

Step 4. Explore other MPC features

Explore other MPC features, such as creating transactions or signing messages, at your own pace. When you're ready, move on the next step—installing and initializing the Unity SDK in your project.

Next steps

Install and initialize the SDK

Was this helpful?
Happy React is loading...