Exploring Fee Abstraction on the Celo Blockchain

The Celo protocol distinguishes itself with features designed to enhance real-world usability and flexibility. One of the key concepts of the protocol, previously known as Fee Currency, has been renamed to Fee Abstraction and provides the powerful capability for users to pay gas fees with a variety of tokens, significantly improving user experience and accessibility on the Celo blockchain. For example, Opera’s MiniPay wallet leverages this feature to enable seamless transaction fee payments with stablecoins like cUSD. In this post, we’ll explore what Fee Abstraction is, why it matters, and how developers can implement it in their wallets and dApps.

What is Fee Abstraction?

Fee Abstraction enables users to pay for gas fees using various tokens, in addition to Celo’s native token, CELO. Unlike other blockchains that require gas payments to be made solely in their native asset, Celo supports gas fee payments in multiple tokens. Currently, there are seven supported tokens (all noted in the Fee Abstraction smart contract), including USDC, USDT, cUSD, and a number of regional stablecoins. This feature involves fetching exchange rates from on-chain oracles to determine the equivalent gas fee in the chosen token, which is then used for the transaction.

Technically, any type of token can be chosen to be integrated into Fee Abstraction. In practice, developers need to make minor adjustments to the token contract, provide a currency-specific oracle for on-chain gas fee calculations in CELO, and get approval from Celo governance to add the token. When a user opts to pay gas fees with a different token, the oracle provides an exchange rate, allowing the transaction to proceed with the chosen token. Validators receive gas fee tips in these various tokens and can manage them as they wish, while the base fee is split between a portion that is converted to CELO and burned and another portion allocated for carbon offsetting through the FeeHandler contract. cLabs is planning upgrades for some of the mechanics of the Fee Abstraction feature after the launch of Celo L2, mainly reducing the hurdles to add more tokens and simplifying the maintainability for integration partners.

Why is Fee Abstraction Important?

Fee Abstraction offers several key advantages that enhance the usability and appeal of the Celo blockchain:

1. User-Friendly Experience: By allowing gas fees to be paid with various tokens, users can utilize the tokens they already hold. This removes the need to maintain separate balances of CELO just for transaction fees, making the blockchain more intuitive and accessible.

2. Cost Efficiency: Transactions using Fee Abstraction remain low-cost, aligning with Celo’s commitment to affordable blockchain interactions. Users can potentially reduce their transaction costs by selecting tokens with lower fees or better value.

3. Permissionless and Flexible: The governance-controlled mechanism for activating tokens as gas currencies ensures that any token can be used for gas payments, provided the community approves. This flexibility encourages broader adoption by accommodating diverse user preferences.

4. Ecosystem Growth and Innovation: Developers can leverage Fee Abstraction to build more user-friendly dApps, attracting more users and increasing transaction volumes. This drives ecosystem growth and fosters innovation on the Celo blockchain.

How can wallets implement Fee Abstraction? - the end user is paying for the transaction

For wallet providers, integrating Fee Abstraction can significantly enhance the user experience. MiniPay by Opera illustrates this capability by allowing transactions with stablecoins like cUSD, catering to web2 users accustomed to fiat equivalents. Similarly, Valora utilizes a similar mechanism to streamline user transactions when interacting with a wide selection of stablecoins, enhancing accessibility and usability.

In scenarios where a user initiates a transaction through a wallet, the wallet dictates the fee currency. This means that for dApp developers focusing on end user interactions, adding a specific fee currency is unnecessary as it will always be overridden by the wallet’s settings.

Here’s a brief guide on how to implement this feature:

  • Step-by-Step Integration: Utilize the viem library for a straightforward integration process. A detailed tutorial is available on Celo Docs to guide you through enabling Fee Abstraction in your wallet.
  • User Transaction Preparation: Incorporate the feeCurrency field in transaction preparations to allow users to select their preferred token for gas fees. This ensures a seamless and flexible transaction experience for your users.
  • Support for Diverse Tokens: Adapters for different decimal standards can be used to ensure compatibility with various tokens, offering users a wide range of choices for gas fee payments.

How can dApps implement Fee Abstraction? - the dApp/protocol is paying for the transaction

dApp developers can also benefit from implementing Fee Abstraction, especially in scenarios where the dApp or protocol pays for the transaction fees:

  • Stablecoin Only Experiences: Fee Abstraction allows dApp developers to build experiences that only operate with stablecoins, without having to sponsor gas or dealing with any additional infrastructure complexity. Such dApps must integrate with the growing list of wallets that support Gas Abstraction, namely: Valora, Minipay, and Celo Terminal.
  • Currency Selection: Developers can choose the preferred token for gas payments based on the cost-effectiveness and availability, enhancing the transaction process within the dApp.
  • Transaction Examples: Common use cases include swaps, storage, indexers, and paymasters for account abstraction. By integrating Fee Abstraction, these transactions can be optimized for better token management/financial portfolio and cost efficiency.
  • Technical Guidance: Refer to the Celo Docs for step-by-step guidance on integrating Fee Abstraction into your dApp. This will ensure smooth implementation.

Fee Abstraction is transforming the way blockchain transactions are conducted, making them more user-friendly, cost-efficient, and flexible. We encourage wallet and dApp developers to explore the tutorials to learn more about this feature. As we gear up for EthGlobal Brussels, we’re excited to showcase Fee Abstraction as a bounty, inviting developers to build and innovate with this feature. Join us at EthGlobal Brussels to explore the possibilities of Fee Abstraction!

7 Likes

Without Accouunt Abstraction, all chains will have much lower adoption potential. Indeed.