Overview
Particle Network’s Wallet Abstraction stack is available through SDKs for more than nine frameworks and platforms. This page covers the basic flow of building a React web application on peaq that onboards users into ERC-4337 smart accounts through social logins. To try Particle Network for yourself, head over to their web demo. A complete demo repository containing the code covered on this page is on GitHub.Integration options
Particle Network’s Wallet Abstraction stack can be used through several mechanisms, each varying in complexity and integration flow:- Particle Connect, a custom connection kit (similar to RainbowKit) that handles both social logins and Web3 wallet connections. Available for Web, Unity, Android, iOS, Flutter, and React Native.
- Particle Auth, the primary library for social logins, through either a standard modal provided by Particle or lower-level shortcuts within your own interface.
Part 1: Installation
Working with Particle Auth Core alongside Particle’s AA SDK involves the installation of a few core libraries:@particle-network/auth-core-modal, the primary mechanism for social logins.@particle-network/aa, for generating and assigning ERC-4337 smart accounts to the traditional accounts (EOAs) created through social login.@particle-network/chains, for using peaq.
Part 2: Configuration
Both@particle-network/auth-core-modal and @particle-network/aa are configured independently, but both need the same three values from the Particle dashboard:
- projectId
- clientKey
- appId
- Log in or sign up to the Particle dashboard.
- Create a new project.
- Within this project, create an application.
- Copy the Project ID, Client Key, and App ID from the dashboard. If applicable, save these to environment variables within your application.
@particle-network/auth-core-modal, open it within your JSX and use the options property for configuration. It takes the following values:
projectId,clientKey, andappId. These are the values you found on the Particle dashboard.wallet, a collection of properties for configuring the embedded wallet modal that optionally shows after a user logs in with their social account.walletcontains:visible, a Boolean dictating whether the embedded wallet interface is shown post-login. Iftrue, this materializes by default through a button placed near the bottom right of the application.customStyle, which, in this example, takessupportChains, an array of chain objects that dictate the blockchains supported within the embedded wallet modal. To lock this to peaq, importPeaq(peaq mainnet, chain ID 3338) orPeaqAgungTestnetfrom@particle-network/chains.
erc4337, used for specifying a Smart Account implementation to be shown within the embedded wallet modal rather than the EOA. Ifvisibleisfalseonwallet, ignore this property.erc4337contains:name, the name of the Smart Account implementation used within your application. For both peaq and agung, this should be'SIMPLE'.version, the version of the Smart Account implementation referenced inname. Only'1.0.0'is supported with'SIMPLE'.
@particle-network/aa is configured within the same component where you use Particle Auth. Its key object is SmartAccount, which, once initialized, manages the user’s smart account end to end.
After configuring Particle Auth Core, define provider from the useEthereum hook (imported from @particle-network/auth-core-modal). provider is the EIP-1193 provider object needed to configure an attached smart account. Pass it to a new instance of SmartAccount, along with an object containing:
projectId,clientKey, andappId, as previously defined inAuthCoreContextProvider.aaOptions, containing:accountContracts, a collection of the Smart Account implementations you intend to support. For peaq, this should just be:SIMPLE, an array of objects which takes:chainIds, an array of chain IDs (integers) for the blockchain(s) you’ll be using the Smart Account on.version, the version of the Smart Account you’ll use; in the case ofSIMPLE, this should be'1.0.0'.
Part 3: Social Login
Using Particle Auth, users are onboarded through Web2 social accounts such as Google, Twitter, and email. To initiate social logins programmatically, use the useConnect hook from@particle-network/auth-core-modal. useConnect exposes the connect function, which handles social logins. It takes the following parameters:
socialType, the specific social login mechanism to be opened. If this is left as a blank string (''), a generalized interface opens, allowing a user to enter their email, choose an external social account, and so on. A string such as'google'or'twitter'opens that provider directly.chain, the blockchain to be connected to. This should be an object from@particle-network/chains, eitherPeaqorPeaqAgungTestnetin this case.
connect:
Part 4: Transaction Execution
Transactions can be executed with@particle-network/aa in one of two ways: through the instance of SmartAccount directly, or through an external Web3 library such as Ethers or Web3.js.
Option 1: Using SmartAccount
Instances of SmartAccount have methods for constructing and executing transactions, otherwise known as UserOperations (within the ERC-4337 standard):
sendTransactionsendUserOperationsendSignedUserOperationbuildUserOperationgetFeeQuotessignUserOperation
sendTransaction. For the others, see Particle Network’s documentation.
sendTransaction constructs and executes any standard transaction, just as you would with Ethers, Web3.js, or a related library. Transactions are constructed with typical parameters such as to, value, and data. Upon calling sendTransaction on your SmartAccount instance, the user is asked to confirm the transaction through an in-app popup, after which it is executed on-chain.
Option 2: Using Ethers
More commonly, an instance of SmartAccount is used to construct an instance of Ethers (or Web3.js, viem, and so on), for a more standardized mechanism of programmatic interaction. This is done by building an intermediary EIP-1193 provider object with AAWrapProvider from@particle-network/aa, using your instance of SmartAccount. Plug this into an object such as new ethers.providers.Web3Provider and you can interact with the smart account directly through Ethers:

