Skip to main content

Overview

This guide covers creating and using an ERC-4337 smart wallet from a native iOS or Android app. By the end, your app will be able to:
  • Create an embedded wallet on mobile that serves as the smart wallet’s signer
  • Derive a deterministic smart wallet address from the signer
  • Send gas-sponsored transactions via a hybrid client-server architecture
Privy’s native smart wallet integration (SmartWalletsProvider) is available for React and React Native. For iOS and Android apps, a hybrid architecture enables smart wallet functionality. The mobile app creates an embedded wallet and signs UserOperation hashes. A Node.js backend manages the smart wallet infrastructure. This architecture keeps wallet keys on the device (self-custodial). Server-side tooling handles ERC-4337 operations. Smart wallets architecture

Prerequisites

Architecture overview

The transaction flow for a smart wallet on native mobile:
  1. The mobile app creates an embedded wallet (EOA). This wallet acts as the smart wallet’s signer.
  2. The backend derives a deterministic smart wallet address from the signer’s address.
  3. For each transaction:
    • The mobile app sends transaction details to the backend.
    • The backend constructs a UserOperation and returns the hash to sign.
    • The mobile app signs the hash with the embedded wallet.
    • The mobile app sends the signature back to the backend.
    • The backend submits the signed UserOperation to the bundler.

Step 1: Create an embedded wallet

Create an Ethereum embedded wallet on the mobile device. This wallet acts as the EOA signer controlling the smart wallet.
If your app already creates embedded wallets for authenticated users, skip this step and use the existing wallet as the signer.

Step 2: Set up the server-side smart wallet infrastructure

Use permissionless and viem on the backend to derive the smart wallet address. This example uses Kernel (ZeroDev). Any ERC-4337 smart account implementation works.
The smart wallet address is deterministic. Given the same signer address, the derived smart wallet address is always the same, even before deployment.

Step 3: Prepare a UserOperation on the server

The backend constructs the UserOperation and returns the hash for the mobile app to sign.

Step 4: Sign the UserOperation hash on mobile

The mobile app receives the userOpHash from the backend and signs it with personal_sign.

Step 5: Submit the signed UserOperation

The backend attaches the signature to the UserOperation and submits it to the bundler.

Full example: Sponsored USDC transfer

This example shows the complete flow for a gas-sponsored USDC transfer.

Next steps

Gas sponsorship

Configure paymasters to sponsor gas fees for your users.

Smart wallet overview

Learn more about smart wallet features and supported providers.

Batch transactions

Send multiple transactions atomically from a smart wallet.

Dashboard configuration

Set up bundlers, paymasters, and supported networks.