Overview
The Kotlin SDK allows you to create and manage embedded wallets in your Android application. This includes creating wallets, deriving wallet accounts, and accessing wallet information. Before we start, ensure you’re familiar with the concepts of Wallets and Wallet Accounts.Creating a wallet
After a user authenticates, you can create an embedded wallet for them using thecreateWallet function from the TurnkeyContext. You need to provide the wallet parameters, such as the wallet name and the accounts to derive.
This example creates a wallet named “Wallet-<timestamp>” with both an Ethereum and a Solana account:
wallets property in the TurnkeyContext. This property is a StateFlow that updates whenever wallets are created or modified.
refreshWallets function from the TurnkeyContext:
Creating wallet accounts
You can specify which accounts to derive when creating a wallet using theaccounts parameter in the createWallet function, as shown in the previous section. Each account is defined using the V1WalletAccountParams class, where you can set properties
V1WalletAccountParams
Configuration used to derive a single wallet account (curve + derivation path + address format).
| Property | Type | Required | Description |
|---|---|---|---|
addressFormat | V1AddressFormat | yes | Output address format for the chain (e.g., ADDRESS_FORMAT_ETHEREUM, ADDRESS_FORMAT_SOLANA, ADDRESS_FORMAT_TRON). |
curve | V1Curve | yes | Curve used to derive the key (e.g., CURVE_SECP256K1 or CURVE_ED25519). Must match the chain. |
path | String | yes | Derivation path (e.g., "m/44'/60'/0'/0/0" for Ethereum). |
pathFormat | V1PathFormat | yes | Path syntax, always PATH_FORMAT_BIP32 |
After wallet creation
You can use thecreateWalletAccount function from the TurnkeyContext.client to add additional accounts to an existing wallet after it has been created.
Importing and exporting wallets
The Kotlin SDK lets you securely import/export wallets, accounts, and private keys using bundles you control, enabling backup, recovery, and migration.Export
Wallets
Export a specified wallet and its accounts.The Kotlin SDK wallet export will decrypt locally and return the secret to you (mnemonic).
ExportBundle instead, use the lower-level client method:
Wallet accounts
Export a specific wallet account.The Kotlin SDK does currently provide helpers for exporting individual accounts. Use the lower-level client method: