Creating an MPC wallet

MPC Wallet

To generate a new MPC wallet using the createMpcWallet() method, This process generates shards, including:

  • name: The name of master wallet

  • Mnemonic: The mnemonic phrase generated by the mobile app.

  • numParties child wallet keys

  • wallets: A list of MpcKeyGenWallet to perform keygen. Each item requires:

    • derivationPath: The derivation Path of Wallet.

    • ChainId: The chain name (e.g., ethereum, solana).

    • ecType: The cryptographic algorithm type (eddsa, ecdsa).

Additional Notes:
    - Use Trust Wallet Core to derive the `secret` using the Derivation Path.
        - CoinType.ethereum
        - CoinType.solana
        - CoinType.arbitrum
        - More coins : https://trustwallet.github.io/docc/documentation/walletcore/cointype/
    - Refer to the Trust Wallet Registry for `ChainId` and `ecType`: https://github.com/trustwallet/wallet-core/blob/master/registry.json

Example:


let walletResponse = client.createMpcWallet(
    name: "KeyGenGroupID123",
    numParties: 2,
    mnemonicPhrase: "your mnemonic phrase here",
    wallets: [
        MpcKeyGenWallet(
            derivationPath: "m/84/0/0/0/0",
            chainId: "ethereum",
            ecType: "ecdsa"
        )
    ]
)

for masterWallet in walletResponse.masterWallets {
    for wallet in masterWallet {
        // Assuming wallet has properties: keyIdentity, ecType, and address
        print("keyIdentity: \(wallet.keyIdentity) - ecType: \(wallet.ecType) - address: \(wallet.address)")
    }
}

Mnemonic Compatible MPC Wallet

To generate a new MPC wallet using the createMnemonicWallet() method, This process generates shards, including:

  • name: The name of master wallet

  • Mnemonic: The mnemonic phrase generated by the mobile app.

  • numParties child wallet keys

  • wallets: A list of KeyGenWallet to perform keygen. Each item requires:

    • secret: The private key of the Child Wallet (derived from the mnemonic phrase).

    • walletAddress: The public address or public key of the Child Wallet.

    • ChainId: The chain name (e.g., ethereum, solana).

    • ecType: The cryptographic algorithm type (eddsa, ecdsa).

Additional Notes:
    - When receiving the backup from `createMpcWallet()`, please ensure that the server shards of the newly created Paillier group and Keygen group are stored in a safe and secure location.
    - Use Trust Wallet Core to derive the `secret` using the Derivation Path.
        - CoinType.ethereum
        - CoinType.solana
        - CoinType.arbitrum
        - More coins : https://trustwallet.github.io/docc/documentation/walletcore/cointype/
    - Refer to the Trust Wallet Registry for `ChainId` and `ecType`: https://github.com/trustwallet/wallet-core/blob/master/registry.json

Example:


let walletResponse = client.createMnemonicWallet(
    name: "KeyGenGroupID123",
    numParties: 2,
    mnemonicPhrase: "your mnemonic phrase here",
    wallets: [
        KeyGenWallet(
            secret: "derived private key",
            walletAddress: "0xYourWalletAddress",
            chainId: "ethereum",
            ecType: "ecdsa"
        )
    ]
)

for masterWallet in walletResponse.masterWallets {
    for wallet in masterWallet {
        // Assuming wallet has properties: keyIdentity, ecType, and address
        print("keyIdentity: \(wallet.keyIdentity) - ecType: \(wallet.ecType) - address: \(wallet.address)")
    }
}

Last updated