Mobile (Android/iOS) Quickstart - AA

Implementing Particle's Modular AA Stack within Mobile Applications

Recently, Particle Network released its modular AA stack, enabling full-stack utilization of account abstraction on various mobile and desktop platforms, working natively with Particle's Wallet-as-a-Service. The Particle AA SDK handles smart account deployment and assignment, UserOperation construction, session keys, and more. This is built around modularity, with the ability to function across various smart account implementations and AA infrastructure providers if needed.

Specifically, this stack includes:

  • The Particle Bundler: Particle Network's in-house, open-source Bundler, responsible for almost 1 million UserOperations.
  • Particle's Omnichain Paymaster: Facilitates cross-chain USDT-based gas sponsorships from a single deposit.
  • Particle's AA SDKs: These streamline the implementation of AA natively with Particle's Wallet-as-a-Service.

On this page, you'll find a brief walkthrough on installing and configuring the Particle AA SDK across each mobile platform. For more information on the specific utilization details within each platform, head over to Introduction to Smart Wallet-as-a-Service. Otherwise, if you'd like to learn more about Particle Network's Modular Smart Wallet-as-a-Service, look at Modular Smart Wallet-as-a-Service.


β€Ž

Installing and configuring the AA SDK

As mentioned, Particle has different AA SDK instances deployed across major mobile platforms. These include Android (through Kotlin), iOS (through Swift), Flutter (through Dart), React Native (through JavaScript), and Unity (through C#). Each has a slightly different configuration and initialization mechanism, although you'll need to begin by installing the SDK corresponding to your platform.

PlatformPackage
Androidnetwork.particle:aa-service
iOSParticleAA (through pod)
Flutterparticle_aa
React Native@particle-network/rn-aa
Unityhttps://github.com/Particle-Network/particle-unity/tree/main/Assets/ParticleNetwork/Mobile/Modules/AA

To leverage the AA SDK corresponding to your platform, you'll first need to integrate either Particle Connect or Particle Auth. These SDKs, on mobile platforms, act as middleware enabling account abstraction within the typical Particle Auth or Particle Connect interaction flow. Once you've configured either of the SDKs, you'll need to go ahead and initialize the AA SDK, such as is shown below:

// Android
val apiKey = mapOf(
            Ethereum.id to "YOUR_BICONOMY_API_KEY",
            EthereumGoerli.id to "YOUR_BICONOMY_API_KEY",
            Polygon.id to "YOUR_BICONOMY_API_KEY"
        ) // Optional, only if using Biconomy's paymaster

ParticleNetwork.initAAMode(apiKey, aaService = BiconomyAAService) // BiconomyAAService, CyberConnectAAService, or SimpleAAService

ParticleNetwork.getAAService().enableAAMode()


// iOS
let biconomyApiKeys: [Int: String] = [
  ParticleNetwork.ChainInfo.ethereum(.mainnet).chainId: "YOUR_BICONOMY_API_KEY",
  ParticleNetwork.ChainInfo.ethereum(.goerli).chainId: "YOUR_BICONOMY_API_KEY",
  ParticleNetwork.ChainInfo.bsc(.testnet).chainId: "YOUR_BICONOMY_API_KEY",
  ParticleNetwork.ChainInfo.polygon(.mainnet).chainId: "YOUR_BICONOMY_API_KEY",
  ParticleNetwork.ChainInfo.polygon(.mumbai).chainId: "YOUR_BICONOMY_API_KEY"  
] // Optional, only if using Biconomy's paymaster

// .biconomy, .cyberConnect, or .simple
AAService.initialize(name: .biconomy, version: .v1_0_0, biconomyApiKeys: biconomyApiKeys) // biconomyApiKeys is optional

let aaService = AAService()
aaService.enableAAMode()

ParticleNetwork.setAAService(aaService)

// Flutter
Map<int, String> biconomyApiKeys = {
  1: "Biconomy Paymaster API key",
  5: "Biconomy Paymaster API key", 
  137: "Biconomy Paymaster API key",
  80001: "Biconomy Paymaster API key"  
}; // Optional, only if using Biconomy's paymaster

// BICONOMY, CYBERCONNECT, or SIMPLE
ParticleAA.init(AccountName.BICONOMY, VersionNumber.V1_0_0(), biconomyApiKeys); // biconomyApiKeys is optional

ParticleAA.enableAAMode();

// Unity
var biconomyApiKeys = new Dictionary<int, string>
{
    { 1, "your ethereum mainnet key" },
    { 5, "your ethereum goerli key" },
    { 137, "your polygon mainnet key" },
    { 80001, "your polygon mumbai key" }
}; // Optional, only if using Biconomy's paymaster

// BICONOMY, SIMPLE, or CYBERCONNECT
ParticleAAInteraction.Init(AAAccountName.BICONOMY, AAVersionNumber.V1_0_0(), biconomyApiKeys); // biconomyApiKeys is optional

β€Ž

Learn more

For a deep dive into these different SDKs, select your platform from the cards listed below. This will take you directly to the SDK reference.

Web3 API Cards

Unity SDK

Implementing account abstraction within games built on Unity.

Explore

Android SDK

Implementing account abstraction within Android applications.

Explore

iOS SDK

Implementing account abstraction within iOS applications.

Explore

Flutter SDK

Implementing account abstraction within applications built using Flutter.

Explore

React Native SDK

Implementing account abstraction within applications built using React Native.

Explore