Download Trust Wallet
Developer

Introducing Barz: Trust Wallet’s Smart Contract Wallet Solution

Published on: May 29, 2024
Share post
In Brief

Explore Trust Wallet's Barz, a cutting-edge Smart Contract Wallet using the Diamond Proxy Pattern for modular and secure upgrades.

Introducing Barz: Trust Wallet’s Smart Contract Wallet Solution

In February 2024, we successfully launched Trust Wallet SWIFT, an account abstraction wallet to give our users a more secure, smarter wallet. Trust Wallet SWIFT introduced innovative features including passkeys, gas payment with 200+ tokens, 1 step swap & bridging. Trust Wallet SWIFT was also the first time we utilised our Smart Wallet solution “Barz”. Today, this solution is now open source!

Let’s dive into the details of how we got here!

Why we built Barz

Trust Wallet, empowers more than 122 million Web3 users worldwide and understands the common issues and inconveniences users face when using wallets.

Many users struggle with:

While the issues and challenges with mnemonic seed phrases are well known, there are larger security and UX issues as more users are onboarded to Web3.

To provide a solution to these challenges and limitations and ultimately drive more adoption of Web3, we decided to develop a Smart Wallet through Account Abstraction, which offers a fundamental solution overcoming these limitations - Barz.

Barz

Barz is an ERC 4337 compatible Smart Contract Wallet focused on a secure and smarter experience for users through modular, upgradeable, and secure designs.

We aggregated the benefits from each wallet and pioneered new approaches to provide best-in-class service to users. Barz is also one of the first passkey-based 4337 account that’s launched in production.

Barz, at its core is a proxy contract that utilizes the Diamond Proxy Pattern(EIP 2535) for a scalable and secure addition of use cases with high security threshold.

Barz system currently has 12 fully built Facet implementations that can provide features of:

barz-1.png

Let’s dive into Diamond Proxy pattern and how it works with ERC 4337. We’ll go further into the optimization points we made to Diamond for Barz in our next article.

Diamond

Diamond is a modular smart contract system enabled by a multi-faceted proxy stated in EIP-2535.

A multi-faceted proxy is different from the conventional proxy pattern like UUPS(Universal Upgradeable Proxy Standard) and TransparentUpgradeable where they have a single implementation to route the call to.

For example, a UUPS based proxy smart contract stores the single implementation contract address in the EIP-1967 based storage slot and performs upgrade by modifying the storage slot.

intro-barz-7.png

Diamond Proxy on the other hand provides a flexible management of Implementation and higher modularity.

intro-barz-1.png

Upon this system, Barz has made many innovative changes to the Diamond pattern itself for a higher security threshold and smarter wallet experience.

In addition, Barz will soon unveil the industry’s first multi-tier module system that provides maximum modularity and foster a secure open environment for interoperability and scalable addition of use cases.

For a more detailed explanation of Barz, check the full article here in our here developer.trustwallet.com.

Conclusion

The Barz Smart Wallet Architecture utilizing Diamond allows modular and flexible development of a wide array of use cases. It allows each Facet to focus on its specific business logic while providing the flexibility to easily switch each component and maintain interoperability.

This is the first of an article series on Barz. The four-article series will cover:

  1. Introducing Barz: Trust Wallet’s Smart Wallet Solution

  2. Cutting Diamonds: How to make Accounts Awesome????

  3. For Builders By Builders: Introducing the Barz SDK

  4. Multi-tier Module system: A secure foundation for open innovation

In our next article, we’ll share the optimizations we did to make Diamond much better for building smart wallets. Stay tuned for our upcoming articles and releases of powerful use cases of smart wallet built on Barz.

If you have questions or want to use Trust Wallet’s AA SDK in your service or have any ideas for collaboration, please reach out in the smartwallet channel in our Trust Wallet Discord.

Simple and convenient
to use, seamless to explore

Download Trust Wallet