How Etherspot Redefines The Way We Build Ethereum Smart Contracts (Account Abstraction)

22 Apr 2024

As Vitalik Buterin stated in one of his articles, “Account abstraction has for a long time been a dream of the Ethereum developer community.” And there are good reasons for that.

Account abstraction (AA) enables EVM code to implement not only application logic but also verification logic in users' wallets, thus fostering creative freedom in wallet designs. This enables innovative features such as multisigs, social recovery, simpler signature algorithms, post-quantum safe signature algorithms, and upgradeability.

However, the current Ethereum protocol's requirement for transactions originating from an ECDSA-secured externally-owned account (EOA) makes it extremely difficult, adding a 21000 gas overhead to each user operation. EIP-2938 aimed to address this by allowing transactions to start from a contract, not an EOA. Yet, it required significant protocol changes.

And finally, ERC-4337 provides a solution without consensus-layer protocol changes. Defined by this proposal, account abstraction allows users to use smart contract wallets containing arbitrary verification logic instead of EOAs as their primary account.

On March 1, 2023, ERC-4337 was launched on the Ethereum mainnet, with Etherspot, an Account Abstraction SDK provider, playing a pivotal role. Receiving a grant from the Ethereum Foundation to advance this initiative, Etherspot is considered an important participant in this event.

Below, we will explore the details of ERC-4337, AA, and how Etherspot's innovative approach streamlines the onboarding of new users into decentralized applications and the broader blockchain ecosystem.

Understanding ERC-4337

This initiative merges the protocol’s two existing account types, Externally owned accounts and smart contract accounts, into a single contract account facilitating token transactions and contract creations. This fosters creative wallet designs, enabling social recovery, customization, and upgradeability.

Unlike Bitcoin's Unspent Transaction Output (UTXO) module, Ethereum employs an account-based model, tracking and updating accounts’ balances as transactions are confirmed. While EOAs are user-owned and controlled, smart contract accounts are network-deployed smart contracts, both capable of receiving, holding, and sending ether or tokens.

Current Ethereum wallets like MetaMask are EOAs, limited by set rules around EOAs, making wallet setup and private key security measures somewhat complex. Loss of seed phrases often means loss of wallet access.

ERC-4337 addresses these limitations. It combines the functionalities of smart contract accounts and EOAs, simplifying the deployment of desired wallet features.

Unlike EIP-2938, the proposal mentioned above, that required consensus-layer changes, ERC-4337 introduces a higher-layer pseudo-transaction object known as UserOperation. Users send UserOperation objects into a separate mempool, which are then packaged into a transaction by bundlers and included in a block. Bundlers, functioning similarly to validators, pay gas for bundled transactions and receive fees from individual UserOperation executions.

This proposal adds new functions like validateUserOp, making a wallet a smart contract, and introduces a new contract, EntryPoint, serving as a security gate for executing these new functions.

ERC-4337 aims to achieve account abstraction decentralization by allowing any bundlers to participate, avoid consensus changes for faster adoption, and allow for innovative use cases like:

  • aggregated signatures;

  • daily transaction limits;

  • emergency account freezing;

  • whitelisting;

  • privacy-preserving applications.

It also aims to save time and gas as bundlers can package UserOperation objects into a single transaction.

For users, ERC-4337 could revolutionize crypto wallet experiences, enhancing crypto adoption. It simplifies wallet setup, eradicates the need for seed phrase retention, and enables multi-factor authentication and account recovery. Users can access customized services, including auto-pay, pre-approved, and bundled transactions.

It enhances security by reducing human error and offers gas flexibility, as wallets can pay gas fees with any ERC-20 tokens. With this upgrade, developers can build wallets that facilitate gas fee payments in any ERC-20 tokens.

Via ERC-4337, the complicated crypto wallet user experience could be significantly smoothed out, removing a substantial barrier to mass adoption.

Unveiling Open-Source Arka Paymaster

The Paymaster is a smart contract account that manages gas payment policies, enabling projects to cover the transaction costs of their users and eliminating the need for users to hold native blockchain tokens for transaction interactions.

Users, instead, can pay gas fees with any ERC-20 token, such as USDC or USDT. This feature enables application developers to sponsor gas fees and accept gas payments in stablecoins or other ERC-20 tokens, benefiting both developers and users.

A UserOperation can designate another address as its Paymaster; if set, during verification, the entry point checks if the Paymaster is willing to cover the UserOperation cost. If willing, fees are deducted from the Paymaster's staked ETH instead of the wallet, improving transaction workflow.

Building on the flexibility offered by Paymasters, Etherspot presents the open-source Arka Paymaster Service, furthering the quest to refine the Web3 user experience.

Arka is a backend service that validates whether the dApp user is eligible for sponsorship and, if so, generates the necessary sponsorship transaction on their behalf.

The service offers sponsored transactions to allow projects to pay transaction fees on behalf of end-users. Also, developers can leverage the above-mentioned gasless transactions.

You can find out more about how to utilize Etherspot’s Arka Paymaster here.

Exploring Skandha Bundler

ERC-4337 bundler services are intermediaries between users and the Ethereum network, bundling multiple UserOperations (transactions) to ensure their on-chain inclusion. Bundlers collect UserOps transactions via the UserOperation function and submit them as a single transaction to the network, saving gas fees and reducing blockchain congestion. Etherspot has developed a modular Typescript implementation named Skandha.

Skandha provides a developer-friendly bundler for Ethereum ERC-4337 account abstraction. It adheres to the ERC-4337 standard, unlocking numerous benefits for both Ethereum and EVM-compatible chain users and developers:

  • Decentralization: It facilitates access to smart contract wallets without relying on centralized relayers controlled by a single entity.

  • Gas cost savings: By bundling multiple transactions into one.

  • Censorship-resistance: Anybody can launch a bundler service.

Skandha's prominence is showcased by its live operation on 22+ networks, including Ethereum, Polygon, Optimism, Arbitrum, Linea, Gnosis, Fuse, Base, Flare, Mantle, and more. It's compatible with Nethermind nodes, enabling operation on networks like Gnosis and Fuse that primarily use Nethermind clients.

Additionally, Skandha supports L2 chains, and a single instance of Skandha can operate across multiple networks. An exciting feature is its capability with the Shared Mempool, allowing ERC-4337 bundles to function like ETH nodes, promoting true decentralization.

To get started, get an API key at Etherspot’s developer portal.

How to Use It

Accessing and running Skandha is made simple via a one-liner at TransactionKit is the essential tool for developers interested in utilizing both Skandha and Arka.

TransactionKit (TX Kit) is a smart account React library for fast and straightforward Web3 development. In conjunction with Etherspot's Prime SDKPrime SDK, it facilitates seamless access to both Arka and Skandha, offering a comprehensive solution for interacting with the ERC-4337 bundler service and Arka Paymaster Service.

Ideal for any dApp or front-end developers, it hides complex blockchain operations behind React components. With it, you can easily execute transactions, interact with smart contracts, and manage digital assets across 22+ blockchains.

The benefits of employing TransactionKit include enhanced efficiency and a user-friendly interface for managing interactions between Skandha, Arka, and the Ethereum network (or other supported chains). Thereby, developers get the industry's best experience.

It lowers the barrier to Web3 development, intending to bring the next million users into the field. By making blockchain technology more approachable, it aids widespread adoption.

To integrate TransactionKit, developers can check out our docs for a detailed guide; there, you’ll also find all the necessary instructions and resources to get started. The library is user-friendly, well-documented, and designed to accelerate the time spent by a dApp developer of any coding level.

Wrap Up

Implementation of ERC-4337 marks significant milestones in blockchain evolution. Smart accounts offer improved functionality, streamlined user experience, enhanced security, and quantum-resistant cryptography. Although not achieving complete account abstraction yet, it introduces features that improve user experience and pave the way to mass adoption.

Here at Etherspot, we are all set to redefine the way you build decentralized applications. With our ready-to-use products like Prime SDK, Arka, Skandha, and TX Kit, our multi-chain platform is not just leveraging ERC-4337 but also illustrating how the standard can significantly streamline user-blockchain interactions, thereby lowering entry barriers for both developers and end-users.

Follow Etherspot:

Website | X | Discord | Telegram | GitHub

This story was distributed under HackerNoon’s Brand As An Author Program. Learn more about the program here.