Developers Forum for XinFin XDC Network

Satheesh Kumar
Satheesh Kumar

Posted on

[Informative] Account Abstraction Support on the XDC Network with Etherspot

We are thrilled to announce that account abstraction support is now available on the XDC network through Etherspot, and it is live on the testnet! This milestone represents a significant advancement in the usability and functionality of blockchain interactions, making it easier for developers to build more versatile and user-friendly decentralized applications (dApps).

Account abstraction is a concept in the Ethereum blockchain that allows for greater flexibility and functionality when it comes to executing transactions and smart contracts. It is an upgrade to the Ethereum Virtual Machine (EVM) that introduces new features and capabilities.

Traditionally, in Ethereum, user accounts are externally owned accounts (EOAs) and smart contracts are contract accounts. EOAs are controlled by private keys and can send and receive ether, while contract accounts hold the code and state of smart contracts and can be interacted with by sending transactions to them.

Account abstraction brings several benefits to the Ethereum ecosystem:

Enhanced efficiency: By allowing contracts to directly control funds, account abstraction reduces the number of transactions and storage operations required. This leads to improved efficiency and reduces gas costs.

Improved privacy: Account abstraction enables the creation of more sophisticated smart contracts that can handle transactions privately within the contract itself. It eliminates the need for external transactions, enhancing privacy for users.

Flexible fee payment models: With account abstraction, contracts can pay transaction fees on behalf of users. This allows for more flexible fee payment models, such as subscriptions or microtransactions, where users don’t need to have ether to execute transactions.

Customized transaction semantics: Account abstraction opens up possibilities for customizing transaction semantics. Contracts can define their own rules and conditions for executing transactions, enabling more complex and dynamic interactions.

How to Get Started
To start experimenting with account abstraction on the XDC network using Etherspot, follow these steps:

Set Up Your Development Environment:
Ensure you have Node.js installed. Then, clone the Etherspot Modular SDK repository from GitHub:

git clone https://github.com/etherspot/etherspot-modular-sdk.git
cd etherspot-modular-sdk
npm install
Enter fullscreen mode Exit fullscreen mode

Configure the SDK:
Update your environment configuration with the following details:

const bundlerApiKey = 'your-api-key-here';
const bundlerUrl = 'https://testnet-rpc.etherspot.io/v2/51';
const entryPoint = '0x0000000071727De22E5E9d8BAf0edAc6f37da032';
Enter fullscreen mode Exit fullscreen mode

Initialize and Use Etherspot:
Use the following code snippet to initialize Etherspot and interact with the XDC testnet:

import { EtherspotBundler, ModularSdk } from '@etherspot/modular-sdk';
import * as dotenv from 'dotenv';

dotenv.config();

async function main() {
  const modularSdk = new ModularSdk(
    { privateKey: process.env.WALLET_PRIVATE_KEY },
    {
      chainId: 51,
      bundlerProvider: new EtherspotBundler(51, bundlerUrl),
      entryPoint
    }
  );

  const address = await modularSdk.getCounterFactualAddress();
  console.log(`Etherspot Wallet Address: ${address}`);

  // Additional logic for your dApp
}

main().catch(console.error);
Enter fullscreen mode Exit fullscreen mode

Join the Community
We invite developers and enthusiasts to test out these features on the XDC testnet. Your feedback will be invaluable in improving and refining the tools and capabilities we offer.

Stay tuned for more updates as we continue to enhance the Account abstraction capabilities on the XDC network.

Happy coding!

Discussion (2)

Collapse
sjpxdc profile image
Shayne Picard

This is great news! Do you anticipate new efforts to amend the MN deployment protocol to allow operators to enter a smart contract address (in lieu of one of only four specified wallet brands) for rewards deposition? This would dramatically expand functionality and could result in bold new defi applications.

Collapse
sean_ profile image
Sean

Awesome News! I believe at the moment this is only available for developer's testing. When do you think it will be available on the mainnet for usage of the community?