Skip to main content
With gas sponsorship, your users do not need SEI to use your dApp. A paymaster pays the gas instead. This recipe uses Pimlico’s bundler and paymaster on Sei Testnet. It creates an ERC-4337 smart account and sends its first transaction without any SEI in the account.

How it works

An ERC-4337 smart account is a contract wallet. It sends a user operation instead of a normal transaction:
  1. Your code builds a user operation and signs it with the owner key of the smart account.
  2. Pimlico’s paymaster agrees to pay for the operation.
  3. Pimlico’s bundler submits the operation to the EntryPoint contract on Sei.
  4. The first operation also deploys the smart account contract.

Before you start

Put the API key and an owner key in environment variables. The owner key can be any new private key, such as one from generatePrivateKey() in viem/accounts. The account does not need SEI:

Install

If npm stops with an ERESOLVE error about the ox package, run npm install viem permissionless --legacy-peer-deps. permissionless.js declares an optional peer version of ox that can differ from the version that viem installs.

Send a sponsored transaction

sponsored.ts
Run it with npx tsx sponsored.ts. You are done when you see:
The smart account address depends on the owner key, so yours differs. The account holds no SEI, but the transaction still succeeds because the paymaster paid for it. sendTransaction returns after the operation is included in a block. Look up the hash on Seiscan to see the transaction that the bundler submitted.

Notes

  • EntryPoint version. toSimpleSmartAccount uses EntryPoint v0.7 at 0x0000000071727De22E5E9d8BAf0edAc6f37da032 by default. EntryPoint v0.6, v0.7, and v0.8 are deployed on Sei Testnet.
  • Other account types. permissionless.js also supports Safe, Kernel, and other smart accounts. See Pimlico’s smart account comparison.
  • Cost. Pimlico sponsors testnet operations for free. On Sei Mainnet, Pimlico bills you for the gas that its paymaster pays, so you need a paid plan. See Pimlico pricing. To go live, replace seiTestnet with sei.
  • Spending limits. Sponsorship policies in the Pimlico dashboard limit how much you sponsor per transaction, per user, or in total.
  • Send SEI: send a normal transaction from a funded account
  • Pimlico integration: the full walkthrough, with a step-by-step explanation of each client