Skip to main content

About transactions in MPC

Transaction sending step-by-step

This section describes the steps to implement transaction sending using the MPC SDK.

For users who already have an MPC wallet and have successfully performed a backup, implement transaction sending as follows:

  1. Perform a pull-backup and store it on the Sky Mavis backup server.
  2. Load the encrypted private key shard from Sky Mavis backup server.
  3. Prompt the user to enter the recovery password to decrypt the private key shard.
  4. Initialize and send the transaction.

For users who already have an encrypted private key shard stored in the backup server:

  1. Load the encrypted private key shard from the Sky Mavis backup server.
  2. Prompt the user to enter the recovery password to decrypt the private key shard.
  3. Initialize and send the transaction.

For users who don't have an encrypted private key shard in the backup, but have a local backup (QR code), you can import the QR code with the information about the private key shard into another app (feature under development).

Transaction sequence flow

The following diagram illustrates the interaction between your client and MPC Solution transaction creation and signing process.

Transaction JSON

When using mpcCore methods in the MPC JS SDK, you need to construct a transaction JSON object based on the EVM (Ethereum Virtual Machine) standard:

export type UnsignedTransaction = {
to: string;
value: string;
type?: number;
from?: string;
gas?: string;
gasPrice?: string;
input?: string;
data?: string;
nonce?: string;
r?: string;
v?: string;
s?: string;
chainId?: string;

// Typed-Transaction features
// EIP-2930; Type 1 & EIP-1559; Type 2
accessList?: any;

// EIP-1559; Type 2
maxPriorityFeePerGas?: any;

maxFeePerGas?: any;
}

When sending a transaction, you can choose how you want to manage gas fees gas and gasPrice: let the SDK estimate the fees automatically, or estimate them manually before sending the transaction. For more information, see Estimate gas.

Transaction policies

Transaction policies are a set of requirements that must be met before a transaction can be submitted to the blockchain.

Two groups of transaction policies exist:

  • App-specific policies that apply to each app that requests transaction signing from MPC.
  • Global user policies that are to protect end-users' accounts.

The next sections describe each policy in detail.

App-specific policy

Each app has its own policy correspondent to the app's client ID, which is assigned after getting access to the Sky Mavis Account service through the Developer Console. The app must register the addresses of the smart contracts it wants to interact with. After registration, users can only interact with the registered smart contracts using an OAuth 2.0 access token.

Here's an example of an app policy that specifies the list of smart contracts the app and its users can interact with:

{
"appID": "11b81fab-f0ee-4434-bb1d-97f2a32d5e09",
"WhitelistContract" : ["0xabcd", "0xdefgh"]
}
info

For efficient policy management, apps that interact with smart contracts such as ERC 721 and ERC 1155, should use a Proxy model for contract deployment.

Global policy

This policy is specifically designed for users to protect their accounts.

Default payment limitation (level 1)

When a user creates a new account, this policy applies by default. It is also referred to as the level 1 payment limit.

TokenLimit per transactionDaily accumulated limit
AXS50300
RON10005000
USDC10005000
WETH0.10.3

Advanced payment limitation (level 2)

When users take additional security measures, such as turning on MFA (multi-factor authentication), their payment limit is raised to level 2, which allows policy customization.

Was this helpful?
Happy React is loading...