Skip to main content

Recover a wallet from backup


This guide describes how to recover an MPC wallet from a backup on the Sky Mavis server. The recovery process helps the player re-access their wallet on a new device or new client. The implementation steps described here only apply to the standard Sky Mavis backup flow.

When performing recovery, the system fetches the user's encrypted private key shard from the Sky Mavis keystore, and assuming that the user provides the correct recovery password, the recovery is successful.


Step 1. Verify that user has MPC wallet

To verify that the wallet is created and that the user can recover it when needed, send a request to the user info endpoint of the Sky Mavis OAuth 2.0 API to retrieve the user's profile.


The use of the user info endpoint requires an API key for authentication.

The request must be made from your backend server instead of the game client.

Authorization: Bearer {ACCESS_TOKEN}

In the response, the ronin_address field must not be empty, and the wallet_type field must be equal to mpc.

"ronin_address": "0x6fda69632c0393c6f740323bd402993d933a7b2b",
"wallet_type": "mpc",

Step 2. Pull encrypted key from Sky Mavis server

const encryptedKey = await mpcCore.getBackupKey(accessToken: string);


// OAuth 2.0 access token
const accessToken = `${ACCESS_TOKEN}`;
const encryptedKey = await mpcCore.getBackupKey(accessToken);

Step 3. Decrypt private key shard

During the wallet creation process, you asked the user to create a password to encrypt the private key shard. Your client needs to collect this password to decrypt the private key.

const privateKeyShard = await mpcCore.decryptKey(accessToken, encryptedKey, password);


const accessToken = `${ACCESS_TOKEN}`;
const encryptedKey = `${ENCRYPTED_KEY}`;
const password = `${RECOVERY_PASSWORD}`;
const privateKeyShard = await mpcCore.decryptKey(accessToken, encryptedKey, password);

If the user enters the password correctly, the decryption is successful.

Next steps

Create a transaction

Was this helpful?
Happy React is loading...