How to Use Gelato’s Gasless Wallet SDK

Gelato Team

Feb 24, 2023

The main barrier to mass adoption of web3 is the current onboarding experience and UX. Web2 set the standard by onboarding even non-digital users easily. If we expect users to create blockchain wallets and safeguard private keys, adoption will stall. Instead, seamless onboarding (like social logins) can make web3 accessible to everyone.

One promising solution is account abstraction. With account abstraction, users interact with the blockchain through smart contract wallets (e.g. Gnosis Safe), which can be programmed for user-friendly features like social login and gasless transactions. Check out our tweet thread to learn more about why account abstraction is critical for mainstream adoption.

It’s still unclear whether smart contract wallets will fully replace EOAs, but proposals like ERC-4337 are paving the way.

Gelato Gasless Wallet

The Gelato Gasless Wallet lets developers easily create smart contract wallets, dramatically simplifying onboarding for non-technical users.

It includes two packages:

  1. Gasless Wallet SDK

  2. Gasless Onboarding SDK

Gasless Wallet SDK

An account abstraction implementation using EOA-owned Gnosis Safe Proxies. Transactions are relayed via Gelato’s 1Balance, enabling projects to sponsor gas fees.

Getting Started

yarn add @gelatonetwork/gasless-wallet

Import and configure:

import {
  GaslessWallet,
  GaslessWalletConfig,
} from "@gelatonetwork/gasless-wallet";
import { ethers } from "ethers";

const eoaProvider: ethers.providers.ExternalProvider | ethers.providers.JsonRpcFetchFunc = ...;

const gaslessWalletConfig: GaslessWalletConfig = {
  apiKey: "1BALANCE_API_KEY",
};

const gaslessWallet = new GaslessWallet(eoaProvider, gaslessWalletConfig);
await gaslessWallet.init();

Wallet deployment is deferred until the first transaction. You can check status:

const isDeployed = await gaslessWallet.isDeployed();

Send a transaction:

const { data } = await mintingContract.mint();
const { taskId } = await gaslessWallet.sponsorTransaction(
  mintingContract.address,
  data
);

Benefit: Relayed transactions originate from the smart contract wallet (msg.sender), not the user’s EOA.

Gasless Onboarding SDK

Integrates Web3Auth features like social login and passwordless onboarding, plus gasless wallet creation.

Getting Started

yarn add @gelatonetwork/gasless-onboarding

Import and initialize:

import {
  GaslessOnboarding,
  GaslessWalletConfig,
  GaslessWalletInterface,
  LoginConfig,
} from "@gelatonetwork/gasless-onboarding";

const gaslessWalletConfig: GaslessWalletConfig = { apiKey };
const loginConfig: LoginConfig = {
  chain: { id: CHAIN_ID, rpcUrl: RPC_URL },
  openLogin: { redirectUrl: "REDIRECT_URL" },
};

const gaslessOnboarding = new GaslessOnboarding(loginConfig, gaslessWalletConfig);
await gaslessOnboarding.init();

Login & Logout

const web3AuthProvider = await gaslessOnboarding.login();
await gaslessOnboarding.logout();

const provider = new providers.Web3Provider(web3AuthProvider);

User Info

await gaslessOnboarding.getUserInfo();

Gasless Wallet Access

const gaslessWallet: GaslessWalletInterface = gaslessOnboarding.getGaslessWallet();

Social Login Flow

  1. Web3Auth creates an EOA for the user (first login) and reuses it thereafter.

  2. A Safe smart contract wallet is prepared but deployed only at first transaction.

  3. Transactions are relayed via Gelato 1Balance, with the Safe as msg.sender.

This flow requires nothing beyond social login—no extensions, no provider initiation, no manual wallet connection.

Gelato is paving the way to onboarding the next billion users to web3!

About Gelato

Gelato is the Web3 Cloud Platform enabling automated, gasless, and off-chain-aware Layer 2 chains and smart contracts. 400+ projects use Gelato to power millions of DeFi, NFT, and gaming transactions.

  • Gelato RaaS: Deploy ZK or OP L2 chains in one click with native Account Abstraction and Gelato middleware baked in.

  • Web3 Functions: Connect smart contracts to off-chain data & computation with decentralized cloud functions.

  • Automate: Automate smart contracts with reliable decentralized execution.

  • Relay: Enable scalable, gasless transactions with an easy-to-use API.

  • Account Abstraction SDK: Built with Safe to combine Gelato's gasless infra with secure smart contract wallets.

Subscribe to our newsletter and follow Gelato on Twitter for updates.
Interested in joining Gelato? Explore careers here.

Ready to build?

Start with a testnet, launch your mainnet in days, and scale with industry-leading UX.

Ready to build?

Start with a testnet, launch your mainnet in days, and scale with industry-leading UX.

Ready to build?

Start with a testnet, launch your mainnet in days, and scale with industry-leading UX.

Ready to build?

Start with a testnet, launch your mainnet in days, and scale with industry-leading UX.