GSN vs Account Abstraction: Blockchain Superheroes in Search of Savings

от автора

In the world of blockchain, where the word «gas» is most often associated not with gas stations, but with fees for transactions in Ethereum, the search for ways to minimize these costs is becoming increasingly relevant. Less heartache for an empty wallet and more time to solve really important issues… for example, what to cook for lunch =)

Similar to the epic Batman vs Superman battle, compare GSN and Account Abstraction. As in any superhero story, each of them has its own unique abilities and disadvantages, which we will look at in detail.

Intro to GSN

GSN (Gas Station Network) is a solution designed to facilitate user interaction with the Ethereum blockchain, allowing them to send transactions without having to pay for gas. GSN is based on the ERC-2771 standard, which allows smart contracts to interpret function calls as if they were made by the end user, although in fact the call is made by an intermediary.

The GSN architecture was described in detail in a previous article. There, the algorithm of component interaction was considered in detail, as well as various scenarios for using the technology. Read more:

Intro to Account Abstraction

Account Abstraction (ERC-4337) is an approach in Ethereum that offers a standardized solution for more flexible account management, which significantly expands their functionality. The main idea is to make accounts more «smart», i.e. to allow contracts to act as user accounts.

Account Abstraction Features

  1. Smart Accounts: ERC-4337 allows users to use smart contracts as accounts that can have their own rules and logic for processing transactions. For example, include automatic transaction approvals, advanced security measures, and other custom logic.

  2. Gasless solutions: Although the main purpose of Account Abstraction is not to create gasless applications, this standard allows you to implement such functionality as an additional option. With smart accounts, you can configure who exactly (the user or a decentralized application) will pay for gas, which makes it possible to create dApps without the need for end users to pay for gas.

  3. Batch Transaction processing: Smart accounts can send multiple transactions as a single batch operation. This is convenient, for example, for performing complex financial transactions where you need to perform several steps sequentially.

  4. Enhanced security and flexibility: With smart accounts, users can implement various levels of security, such as multi-factor authentication or automatic limits on maximum transaction amounts.

Key components of ERC-4337

  1. UserOperation: A data structure representing the user’s operation. It includes all the necessary data, such as the function being called, the operation parameters, and the user signature.

  2. EntryPoint: The central contract in the Account Abstraction system that receives and processes User Operations. Entry Point is responsible for verifying the validity of operations and their execution.

  3. Bundler (or Block Proposer): these agents collect transactions from users and send them to the Ethereum network, including them in blocks.

  4. Smart Account Contract: This is a user’s smart contract that functions as his account on the blockchain. This contract contains logic that defines exactly how incoming transactions should be processed and who and how can initiate transactions on behalf of the user.

This architecture can be extended with additional components:

  • Paymasters: Optional smart contracts designed to finance transactions on behalf of contract accounts. Paymasters can take on gas costs, reducing the burden on users and increasing the availability of decentralized applications.

  • Aggregators: Also optional smart contracts that can act as signature verifiers for transactions originating from multiple contract accounts. Aggregators simplify and optimize the transaction processing process, allowing you to process a large number of signatures and requests efficiently.

Technology comparison

So we’ve come to the most epic part — the battle of two blockchain superheroes! GSN and Account Abstraction are ready to show what they are capable of. Let’s take a closer look at what their advantages and disadvantages are according to key criteria. Let’s get started!

1. The standard used

GSN: GSN uses the ERC-2771 standard, which provides a way to process meta transactions through relay servers.

Account Abstraction: Account Abstraction is based on the ERC-4337 standard, which expands the capabilities of accounts, allowing smart contracts to perform the functions of ordinary user accounts.

2. Security

GSN: Although GSN simplifies the user experience, the relay mechanism can be vulnerable to attacks such as frontrunning (when an attacker intercepts and modifies transactions before they are executed). To minimize such risks, it is necessary to carefully manage voice servers and Paymasters, which requires additional resources and monitoring.

Account Abstraction: Thanks to the use of wallet contracts, the security in Account Abstraction can be customized to the specific needs of users. For example, you can implement multi-factor authentication, set transaction limits, or use multi-signatures. All this makes Account Abstraction safer and more flexible for complex scenarios, but increases the complexity of configuration and use.

3. Scalability

GSN: With the growing number of users and transactions on the network, GSN scalability can become a problem, as relay support is needed to process transactions. If the relay network does not grow at the same rate as the number of transactions, this can lead to delays in execution and even failures.

Account Abstraction: The scalability of Account Abstraction is better managed because this standard allows you to bundle transactions and reduce gas costs thanks to Paymaster contracts and signature aggregators. This allows you to process a large number of operations more efficiently, but adds complexity to the implementation.

4. Batch transactions support

GSN: It is mainly aimed at paying for gas in one operation on behalf of the user, and its capabilities in terms of batch transactions are limited.

Account Abstraction: One of the main advantages of Account Abstraction is the ability to process multiple transactions in a single transaction. For example, users can combine several steps within a single financial transaction, which significantly reduces gas costs and makes the system more efficient.

5. Support of Externally Owned Accounts (EOA)

GSN: Supports working with classic accounts (EOA). This makes it easily compatible with existing Ethereum users and infrastructure.

Account Abstraction: on the contrary, it requires the use of smart contract accounts, which limits the ability to work with classic EOA.

6. Integration with wallets

GSN: Since GSN uses existing Ethereum accounts and relay servers to pay for gas, it is fully compatible with classic wallets such as MetaMask and others. Users do not need to change wallets or set up additional contracts to interact with Daps via GSN.

Account Abstraction: One of the key limitations of Account Abstraction is that it is not compatible with traditional wallets such as MetaMask. To work with this standard, users will need to use wallet contracts that perform the functions of accounts. This makes integration with existing wallets more difficult, but gives developers more flexibility, as they can integrate their own security and transaction processing logic.

7. Architecture and complexity of integration

GSN: has a relatively simple architecture, including relay servers, Paymaster contracts and Recipient smart Contracts. However, relay servers require careful management and monitoring to avoid attacks and unscrupulous behavior. At the same time, GSN provides a lower entry threshold for users with classic wallets, as the architecture is easily integrated with existing applications. Thus, GSN is more relevant for integration into an already developed solution without upgrading the existing architecture.

Account Abstraction: has a more complex architecture. The key components — UserOperation, EntryPoint, and Bundlers — require more detailed integration and configuration. At the same time, Account Abstraction offers great flexibility for developers, since they can independently create the logic of their accounts. However, the implementation of this system requires significant efforts, especially if you need to maintain compatibility with existing dApps and infrastructure.

Conclusion

So, if GSN and Account Abstraction are blockchain superheroes, then GSN can be imagined as a friendly Person‑Spider: Simple, reliable, easily compatible with classic wallets and suitable for most everyday tasks. But when it comes to saving the world (complex operations, multi‑operations and advanced security), Account Abstraction comes on the scene — it’s an Iron Man with an arsenal of high-tech gadgets, ready for any challenges, even if it requires changing a classic suit to a new smart contract.

Each of them has its own strengths and weaknesses: GSN is lightness and compatibility, but with limited flexibility, while Account Abstraction is power and capabilities, albeit with a higher integration bar. Choose your hero depending on whether you need a fast relay or a smart account that can handle many tasks at once. After all, there are not many superheroes in the blockchain, as in life!


ссылка на оригинал статьи https://habr.com/ru/articles/853286/


Комментарии

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *