Build with Trust Wallet and Barz, A Comprehensive Guide to Integrating Barz with AA SDK
Introduction
In this article, we will explore how to seamlessly integrate Trust Wallet’s Smart Accounts with the permissionless.js framework, a library managed by Pimlico to deploy and manage Smart Accounts based on the ERC-4337 standard. Using our SDK, you can create Trust Smart Accounts for your users and enhance your dApp with features such as gasless and batched transactions and much more.
Benefits of a Trust Smart Account
Batch transactions
Sponsored Transactions via Paymaster
Passkey support
Prerequisites
Before you begin, ensure you have the following prerequisites:
Node.js and npm installed on your development environment.
An active account with Pimlico for API access.
Create your Pimlico account here
Get Started
Simplify the user journey and onboard easily while leveraging the advantages of ERC-4337.
Here is how to add smart accounts creation and usage in your dApp in very few steps.
In this article, we’ll walk you through the development of the below demo together:
The full codebase is available here: https://github.com/trustwallet/trustsmartaccdemo

For New Projects
If you're creating a new project, follow these steps:
Step 1: Setup Your Project
First, set up a new React project.
Step 2: Install Dependencies
Install the necessary dependencies:
Step 3: Configure Tailwind CSS
Set up Tailwind CSS for styling your application.
Install Tailwind CSS:
Update tailwind.config.js:
Add Tailwind directives to your CSS file:
For Existing Projects
If you're integrating Trust Smart Accounts into an existing React project, start from the following steps:
Step 4: Install Dependencies
Navigate to your project directory and install the necessary dependencies:
Step 5: Connect Your Wallet
Create a component to connect your wallet using the wagmi library.
Step 6: Create Trust Smart Accounts
Create a component to handle the creation of Trust Smart Accounts.
Step 7: Mint A Gasless NFT
Create a component to mint an NFT without gas fees.
Step 8: Integrate Components In Your App
Combine the components in your main App component.
Conclusion
By following this guide, you have successfully integrated Trust Smart Accounts into your project and enabled the creation of gasless NFTs. This setup leverages the power of account abstraction, giving a better experience to your users in order to interact with your dApps.
Frequently Asked Questions (FAQs)
Which networks are supported?
Ethereum
Arbitrum
Optimism
BNB
Polygon
Avalanche
opBNB
Base
Testnets:
Sepolia
Are there any costs associated to using Smart Accounts?
No. Only costs are related to paymaster.
Security Information
Audits: Our smart contracts have undergone thorough audits by high-profile security firms, ensuring robust protection against vulnerabilities.
Certik https://github.com/trustwallet/barz-dev/blob/main/audit/Certik_Trustwallet-barz-Audit.pdf
Halborn https://github.com/trustwallet/barz-dev/blob/main/audit/Halborn_Trustwallet-barz-Audit.pdf
Open Source: Barz, our smart contract wallet solution, is open-sourced, promoting transparency and allowing the community to review and contribute to its development. https://trustwallet.com/blog/introducing-barz-smart-contract-wallet-solution
Passkeys Support: Trust Smart Accounts support passkeys for an additional layer of security, providing a more secure and user-friendly authentication mechanism.
On-chain security monitoring service: All Trust Wallet smart accounts are automatically monitored by our security monitoring infrastructure for free. All users will be able to maintain a highly secure state and could get immediately notified when a hack occurs. For detailed explanation, please reference this doc.
Resources
Last updated
Was this helpful?