> ## Documentation Index
> Fetch the complete documentation index at: https://docs.learnway.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Paymaster (Gasless Transactions)

> ERC-7677 compatible Paymaster JSON-RPC service for sponsoring ERC-4337 Smart Account transactions.

# Paymaster (Gasless Transactions)

LearnWay operates an ERC-7677 compliant Paymaster service enabling gasless transactions for user smart accounts (e.g. minting NFT certificates, claiming rewards, or transferring USDT).

***

## Sponsor User Operation (`pm_sponsorUserOperation`)

Accepts an unsigned or partial ERC-4337 v0.7 `UserOperation`, validates it against gas policies and rate limits, and returns signed paymaster data (`paymasterAndData`).

### Endpoint

```http theme={null}
POST /paymaster/rpc/:chainId
```

### Path Parameters

| Parameter | Type     | Required | Description                                                            |
| :-------- | :------- | :------- | :--------------------------------------------------------------------- |
| `chainId` | `number` | **Yes**  | Target EVM Chain ID (`1135` for Lisk Mainnet, `4202` for Lisk Sepolia) |

### Request Body (JSON-RPC 2.0)

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "pm_sponsorUserOperation",
  "params": [
    {
      "sender": "0xYourSmartAccountAddress",
      "nonce": "0x1",
      "callData": "0xb61d27f6...",
      "callGasLimit": "0x186a0",
      "verificationGasLimit": "0x186a0",
      "preVerificationGas": "0xc350",
      "maxFeePerGas": "0x3b9aca00",
      "maxPriorityFeePerGas": "0x3b9aca00"
    },
    {
      "entryPoint": "0x0000000071727De22E5E9d8BAf0edAc6f37da032"
    }
  ]
}
```

### Response (200 OK)

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "paymaster": "0x1234567890123456789012345678901234567890",
    "paymasterData": "0x018239...",
    "paymasterVerificationGasLimit": "0x186a0",
    "paymasterPostOpGasLimit": "0x0"
  }
}
```

***

## Sponsorship Policies & Whitelists

* **Target Whitelist**: Only calls targeting verified LearnWay contracts (Badges NFT, Certificates NFT, and approved token transfers) are sponsored.
* **Rate Limits**: Users are allocated a daily gas allowance refreshed every 24 hours.

***

## Submitting to the Alto Bundler (`/alto`)

After receiving the signed `paymasterAndData` payload from this endpoint:

1. Attach the returned fields to your client's `UserOperation`.
2. Dispatch the completed UserOp via standard `eth_sendUserOperation` JSON-RPC to the hosted **Alto Bundler** (`/alto`).
3. The Alto bundler handles bundle simulation, batching, and on-chain submission to the `EntryPoint` contract on Lisk L2.
