# \[Archive\] Send your first transaction with ERC-20 Paymaster | Web3Auth

**URL:** <https://builder.metamask.io/t/archive-send-your-first-transaction-with-erc-20-paymaster-web3auth/1029>\
**Category:** Embedded Wallets (Web3Auth)\
**Created:** [October 30, 2024, 6:53am UTC](https://builder.metamask.io/t/archive-send-your-first-transaction-with-erc-20-paymaster-web3auth/1029 "2024-10-30T06:53:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![shahbaz](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/shahbaz/32/1527_2.png) [@shahbaz](https://builder.metamask.io/u/shahbaz)\
**Post date:** [October 30, 2024, 6:53am UTC](https://builder.metamask.io/t/archive-send-your-first-transaction-with-erc-20-paymaster-web3auth/1029/1 "2024-10-30T06:53:30Z")

</div>

> **🏛 Archived Content from Web3Auth Community**
> 
> This topic was originally posted by **shahbaz** on 10/30/2024.  
> This content has been migrated from our previous community forum to preserve valuable discussions.

* * *

A paymaster is a vital component in the ERC-4337 standard, responsible for covering transaction costs on behalf of the user. There are various types of paymasters, such as gasless paymasters, ERC-20 paymasters, and more.

* * *
This is a companion discussion topic for the original entry at [https://web3auth.io/docs/guides/erc20-paymaster](https://web3auth.io/docs/guides/erc20-paymaster)

---

<div class="post-metadata">

**Author:** ![pratikraj.bhavsar](https://avatars.discourse-cdn.com/v4/letter/p/76d3ee/32.png) [@pratikraj.bhavsar](https://builder.metamask.io/u/pratikraj.bhavsar)\
**Post date:** [May 15, 2025, 10:02pm UTC](https://builder.metamask.io/t/archive-send-your-first-transaction-with-erc-20-paymaster-web3auth/1029/2 "2025-05-15T22:02:53Z")

</div>

Hello,

I tried exactly your tutorial but it does not work  
I created a new project from the [quickstart](https://web3auth.io/docs/quick-start?product=PNP&sdk=PNP_MODAL&framework=REACT&stepIndex=0) then follow this for send usdc and got the following error :  
Unhandled Promise Rejection: UserOperationExecutionError: Paymaster `postOp` function reverted.

and on Pimlico I see this error

{  
“id”: 12,  
“error”: {  
“code”: -32521,  
“message”: “UserOperation reverted during simulation with reason: AA50 postOp reverted 0x7939f424”  
},  
“jsonrpc”: “2.0”  
}

I have generated a debug link on tenderly

 ![](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/1X/cddbc8c95529eb8f355a5d1edf59fcbf65e0d3c4.png)

```
  <a href="https://dashboard.tenderly.co/shared/simulation/993207d6-b149-42ad-a9a7-34f773168c8e" target="_blank" rel="noopener nofollow ugc">dashboard.tenderly.co</a>

```

 ![](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/1X/aa2181d272692e34cdf1236f251893fd5ab0cdf3.png)
### [Tenderly Dashboard](https://dashboard.tenderly.co/shared/simulation/993207d6-b149-42ad-a9a7-34f773168c8e)

Tenderly is a full-stack infrastructure for the entire dapp lifecycle, offering the only node RPC with built-in development environments and tools. Sign up now!

I am stuck on this for a few months and losing my hair. Could you help me ?

Thanks,

Pratik

---

<div class="post-metadata">

**Author:** ![shahbaz](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/shahbaz/32/1527_2.png) [@shahbaz](https://builder.metamask.io/u/shahbaz)\
**Post date:** [May 15, 2025, 10:02pm UTC](https://builder.metamask.io/t/archive-send-your-first-transaction-with-erc-20-paymaster-web3auth/1029/3 "2025-05-15T22:02:53Z")

</div>



---

<div class="post-metadata">

**Author:** ![Ayush](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/ayush/32/1540_2.png) [@Ayush](https://builder.metamask.io/u/Ayush)\
**Post date:** [May 20, 2025, 1:42pm UTC](https://builder.metamask.io/t/archive-send-your-first-transaction-with-erc-20-paymaster-web3auth/1029/4 "2025-05-20T13:42:48Z")

</div>

Hey @pratikraj.bhavsar can you please share the code for AccountAbstractionProvider. We’ll need more details to debug the issue.

---

<div class="post-metadata">

**Author:** ![pratikraj.bhavsar](https://avatars.discourse-cdn.com/v4/letter/p/76d3ee/32.png) [@pratikraj.bhavsar](https://builder.metamask.io/u/pratikraj.bhavsar)\
**Post date:** [May 20, 2025, 3:34pm UTC](https://builder.metamask.io/t/archive-send-your-first-transaction-with-erc-20-paymaster-web3auth/1029/5 "2025-05-20T15:34:27Z")

</div>

> //Blockquote  
> const accountAbstractionProvider = new AccountAbstractionProvider({  
> config: {  
> chainConfig,  
> bundlerConfig: {  
> // Get the pimlico API Key from [dashboard.pimlico.io](http://dashboard.pimlico.io)  
> url: `https://api.pimlico.io/v2/${chainId}/rpc?apikey=${pimlicoAPIKey}`,  
> paymasterContext: {  
> // USDC address on Ethereum Sepolia  
> token: “0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238”,  
> },  
> },  
> smartAccountInit: new SafeSmartAccount(),  
> paymasterConfig: {  
> // Get the pimlico API Key from [dashboard.pimlico.io](http://dashboard.pimlico.io)  
> url: `https://api.pimlico.io/v2/${chainId}/rpc?apikey=${pimlicoAPIKey}`,  
> },  
> },  
> });

> //Blockquote  
> // IMP START - SDK Initialization  
> const privateKeyProvider = new EthereumPrivateKeyProvider({  
> config: { chainConfig },  
> });

> //Blockquote  
> const web3AuthOptions: Web3AuthOptions = {  
> clientId,  
> web3AuthNetwork: WEB3AUTH\_NETWORK.SAPPHIRE\_DEVNET,  
> privateKeyProvider,  
> // Use the account abstraction provider we configured earlier  
> accountAbstractionProvider,  
> // This will allow you to use EthereumPrivateKeyProvider for  
> // external wallets, while use the AccountAbstractionProvider  
> // for Web3Auth embedded wallets.  
> useAAWithExternalWallet: false,  
> };  
> const web3auth = new Web3Auth(web3AuthOptions);

then I send the transaction

> // Use the same accountAbstractionProvider we created earlier.  
> const bundlerClient = accountAbstractionProvider.bundlerClient!;  
> const smartAccount = accountAbstractionProvider.smartAccount!;
> 
> // Pimlico’s ERC-20 Paymaster address  
> const pimlicoPaymasterAddress = “0x0000000000000039cd5e8aE05257CE51C473ddd1”;
> 
> // USDC address on Ethereum Sepolia  
> const usdcAddress = “0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238”;
> 
> // 0.00001 ETH in WEI format  
> const amount = 10000000000000n;
> 
> // 10 USDC in WEI format. Since USDC has 6 decimals, 10 \* 10^6  
> const approvalAmount = 1000000n;
> 
> const userOpHash = await bundlerClient.sendUserOperation({  
> account: smartAccount,  
> calls: [  
> // Approve USDC on Sepolia chain for Pimlico’s ERC 20 Paymaster  
> {  
> to: usdcAddress,  
> abi: parseAbi([“function approve(address,uint)”]),  
> functionName: “approve”,  
> args: [pimlicoPaymasterAddress, approvalAmount],  
> },  
> {  
> to: “0xf63d71b8E48AAdbdcf49bfF0CB849eC98efc4849”,  
> value: amount,  
> data: “0x”,  
> },  
> {  
> to: “0xf63d71b8E48AAdbdcf49bfF0CB849eC98efc4849”,  
> value: amount,  
> data: “0x”,  
> },  
> ],  
> });
> 
> // Retrieve user operation receipt  
> const receipt = await bundlerClient.waitForUserOperationReceipt({  
> hash: userOpHash,  
> });

---

<div class="post-metadata">

**Author:** ![Ayush](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/ayush/32/1540_2.png) [@Ayush](https://builder.metamask.io/u/Ayush)\
**Post date:** [May 21, 2025, 1:46am UTC](https://builder.metamask.io/t/archive-send-your-first-transaction-with-erc-20-paymaster-web3auth/1029/6 "2025-05-21T01:46:13Z")

</div>

Looks like Pimlico’s paymaster address is changed, can you change the `pimlicoPaymasterAddress` to `0x777777777777AeC03fd955926DbF81597e66834C` and try once?

---

<div class="post-metadata">

**Author:** ![pratikraj.bhavsar](https://avatars.discourse-cdn.com/v4/letter/p/76d3ee/32.png) [@pratikraj.bhavsar](https://builder.metamask.io/u/pratikraj.bhavsar)\
**Post date:** [May 21, 2025, 5:30pm UTC](https://builder.metamask.io/t/archive-send-your-first-transaction-with-erc-20-paymaster-web3auth/1029/7 "2025-05-21T17:30:39Z")

</div>

Hello,

it’s working thank you very much.

I am trying to send 1 USDC

Could you tell me what value should I put in

const amount = ?;  
// 10 USDC in WEI format. Since USDC has 6 decimals, 10 \* 10^6  
const approvalAmount = ?;

Regards,

Pratik
