Aarc is a set of tools built to simplify the use of smart accounts.

Etherspot’s infrastructure is included within this tooling and available to use within it.

In this tutorial we’ll learn how to use an Etherspot smart account with the Aarc SDK.

We’ll setup the Smart Account in two steps using Aarc SDK:

  1. Fetch the Smart Account address for the EOA.
  2. Deploy and transfer native funds to the Smart Account.


  1. Create a new directory, initialize npm in it and install Aarc Migrator Package and ethers
mkdir aarc_etherspotSW && cd aarc_etherspotSW && npm init -y && npm i @aarc-xyz/migrator [email protected]
  1. Create a new file index.js in src folder.
  2. Import the dependencies.
const { ethers, BigNumber } = require("ethers");
const { Migrator, WALLET_TYPE}= require("@aarc-xyz/migrator");
  1. Get the Aarc API Key (you can learn how to get it from here), your EOA private key, and the RPC URL.

  2. Initialize the provider and Aarc SDK

let provider = new ethers.providers.JsonRpcProvider("YOUR_RPC_URL");
let signer = new ethers.Wallet("YOUR_PRIVATE_KEY", provider);
let eoaAddress = signer.address;

let aarcSDK = new Migrator({
    rpcUrl: "YOUR_RPC_URL",
    chainId: 80001, // Mumbai Testnet
    apiKey: "YOUR_AARC_API_KEY"
  1. Fetch the Smart Account addresses of the EOA.
async function main() {
    try {
        const smartWalletAddresses = await aarcSDK.getSmartWalletAddresses(
            WALLET_TYPE.ETHERSPOT, // WALLET_TYPE imported from @aarc-xyz/migrator
        console.log(' smartWalletAddresses ', smartWalletAddresses);
    } catch (error) {
        console.error(' error ', error);

Here, we provide the WALLET_TYPE.ETHERSPOT to fetch the Smart Account addresses associated with the EOA. In the response, we will see the addresses associated with the EOA for Etherspot’s Smart Accounts. No Smart Account may be deployed, so it will only generate and return the Smart Account address, mentioning its deployment status and the walletIndex.

  1. Deploy the Smart Account.

To deploy the smart account, use aarcSDK.transferNativeAndDeploy this will take a few parameters, as shown below.

  • deploymentWalletIndex and receiver can be fetched from the above response.
  • amount should be in hex string, which can be easily done by usingBigNumbers from ethers.
async function main() {
    // ... Previous Code ...
    try {
        const response = await aarcSDK.transferNativeAndDeploy({
            walletType: WALLET_TYPE.ETHERSPOT,
            owner: eoaAddress,
            receiver: "0xa1A6dd310A45C4EDB53BF6512317093F820cbA65",
            signer: signer,
            deploymentWalletIndex: 0,
            amount: BigNumber.from("10000")._hex
        console.log("Transfer and Deploy Response: ", response);
        console.error(' error ', error);
  1. Run the script.
node src/index.js

You will see the following response after deploying the Etherspot Smart Wallet.

Transfer and Deploy Response:  [
    tokenAddress: '',
    amount: '0x00',
    message: 'Deployment tx sent',
    txHash: '0x6797639f26391e6d5335090df4984ce84e617908f0c1554756c4c60c0f678f28'
    tokenAddress: '0x0000000000000000000000000000000000001010',
    amount: '0x2710',
    message: 'Token transfer tx sent',
    txHash: '0xd0f141776971f6a6211b514842b02c24c6fde53e9cb392a83e1489d65d9b53b7'