{"eip":7677,"title":"Paymaster Web Service Capability","description":"A way for apps to communicate with smart wallets about paymaster web services","authors":["Lukas Rosario (@lukasrosario)","Dror Tirosh (@drortirosh)","Wilson Cusack (@wilsoncusack)","Kristof Gazso (@kristofgazso)","Hazim Jumali (@hazim-j)"],"status":"Review","type":"Standards Track","category":"ERC","created":"2024-04-03","requires":[4337,5792],"discussionsTo":"https://ethereum-magicians.org/t/erc-7677-paymaster-web-service-capability/19530","repo":"ERCs","label":"ERC-7677","officialUrl":"https://eips.ethereum.org/EIPS/eip-7677","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7677.md","url":"https://eips.huatuo.xyz/eip-7677/","tldr":{"en":"Lets an app tell a smart wallet which paymaster web service should sponsor its gas, and standardizes the two JSON-RPC calls wallets use to talk to that service.","ja":"アプリがスマートウォレットに対して、どの Paymaster Web サービスにガス代を負担させるかを伝えられるようにし、ウォレットがそのサービスと通信するための 2 つの JSON-RPC 呼び出しを標準化する。","ko":"앱이 스마트 지갑에 어떤 paymaster 웹 서비스가 가스비를 후원할지 알려 줄 수 있게 하고, 지갑이 그 서비스와 통신하는 데 쓰는 두 개의 JSON-RPC 호출을 표준화한다.","zh":"让应用告诉智能钱包应由哪个 paymaster Web 服务来赞助其 gas，并标准化钱包与该服务通信所用的两个 JSON-RPC 调用。"},"tags":["account-abstraction","paymaster","wallet","gas-sponsorship","rpc"],"explainers":{"en":{"lang":"en","tldr":"Lets an app tell a smart wallet which paymaster web service should sponsor its gas, and standardizes the two JSON-RPC calls wallets use to talk to that service.","tags":["account-abstraction","paymaster","wallet","gas-sponsorship","rpc"],"related":[4337,5792,7795],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7677/","markdown":"## What problem does it solve?\n\nWith [ERC-4337](/eip-4337/) smart accounts, a *paymaster* can pay gas on a user's behalf. In practice paymasters are run as web services: the app signs up with a provider and gets a URL. But there was no standard way for an app to tell the user's wallet \"use this paymaster for these calls\", and every provider exposed a slightly different API, so wallets could not integrate them generically.\n\nERC-7677 fixes both sides: a wallet capability that carries the paymaster URL from the app, and a common two-method API that every paymaster service implements.\n\n## How it works\n\n**Paymaster service API.** Both methods take the same params: `[userOp, entryPoint, chainId, context]`. The user operation is unsigned, and `context` holds provider-specific fields (for example a policy ID).\n\n- `pm_getPaymasterStubData` returns placeholder paymaster fields used only for gas estimation. For EntryPoint v0.7 it must also return `paymasterPostOpGasLimit`, because the paymaster pays for post-op and cannot trust the wallet's estimate. It may return a `sponsor` object (`name`, optional data-URI `icon`) that the wallet can show, and `isFinal: true` if no second call is needed.\n- `pm_getPaymasterData` returns the real paymaster fields (`paymasterAndData` for v0.6, or `paymaster` + `paymasterData` for v0.7) once gas values are settled. The user then signs.\n\nStub data must be the same length as the final data, have no more zero bytes, and follow the same code path in `validatePaymasterUserOp`/`postOp`; otherwise `preVerificationGas` or gas limits are underestimated.\n\n**Wallet capability.** Building on [EIP-5792](/eip-5792/):\n\n1. The wallet advertises `paymasterService: { supported: true }` per chain in `wallet_getCapabilities`.\n2. The app passes `paymasterService: { url, context }` in `wallet_sendCalls`.\n3. The wallet calls stub data, estimates gas with its bundler, calls paymaster data, asks the user to sign, and submits.\n\nGas estimation deliberately stays with the wallet, since it knows which bundler it will use. The chain ID parameter lets providers offer one URL for many chains if they want.\n\n## Sample code\n\nApp side, using an EIP-1193 provider:\n\n```ts\nconst caps = await provider.request({\n  method: \"wallet_getCapabilities\",\n  params: [account],\n});\n\nif (caps[\"0x2105\"]?.paymasterService?.supported) {\n  await provider.request({\n    method: \"wallet_sendCalls\",\n    params: [{\n      version: \"1.0\",\n      chainId: \"0x2105\",\n      from: account,\n      calls: [{ to: target, value: \"0x0\", data: calldata }],\n      capabilities: {\n        paymasterService: {\n          url: \"https://my-app.example/api/paymaster\", // your backend proxy\n          context: { policyId: \"my-policy\" },          // provider-defined\n        },\n      },\n    }],\n  });\n}\n```\n\nA stub-data response for EntryPoint v0.7:\n\n```json\n{\n  \"sponsor\": { \"name\": \"My App\" },\n  \"paymaster\": \"0x...\",\n  \"paymasterData\": \"0x...\",\n  \"paymasterPostOpGasLimit\": \"0x...\"\n}\n```\n\n## Things to know\n\n- Status is **Review**: the interface may still change before it is final.\n- Paymaster provider URLs often contain API keys. The spec recommends pointing the capability at your own backend, which proxies to the provider and can apply its own checks before sponsoring.\n- The wallet may ignore your paymaster (on service failure, or if the user picks a wallet-provided one), so apps must not assume their paymaster actually paid.\n- Wallets that display the sponsor icon must render SVGs with an `\u003cimg\u003e` tag so no embedded script can run.\n- Paymaster services should reject operations they won't sponsor already at the stub-data step.\n"},"ja":{"lang":"ja","tldr":"アプリがスマートウォレットに対して、どの Paymaster Web サービスにガス代を負担させるかを伝えられるようにし、ウォレットがそのサービスと通信するための 2 つの JSON-RPC 呼び出しを標準化する。","tags":["account-abstraction","paymaster","wallet","gas-sponsorship","rpc"],"related":[4337,5792,7795],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7677/","markdown":"## 何を解決するのか\n\n[ERC-4337](/eip-4337/) のスマートアカウントでは、*Paymaster* がユーザーに代わってガス代を支払えます。実際には Paymaster は Web サービスとして運用されており、アプリがプロバイダーに登録して URL を受け取ります。しかし、アプリがユーザーのウォレットに「これらの呼び出しにはこの Paymaster を使って」と伝える標準的な方法がなく、プロバイダーごとに少しずつ異なる API を公開していたため、ウォレットが汎用的に統合することはできませんでした。\n\nERC-7677 は両面を解決します。アプリから Paymaster の URL を運ぶウォレットの capability と、すべての Paymaster サービスが実装する共通の 2 メソッド API です。\n\n## 仕組み\n\n**Paymaster サービス API。** 2 つのメソッドはどちらも同じ params `[userOp, entryPoint, chainId, context]` を受け取ります。user operation は未署名で、`context` にはプロバイダー固有のフィールド（たとえばポリシー ID）が入ります。\n\n- `pm_getPaymasterStubData` は、ガス見積もりにのみ使うプレースホルダーの paymaster フィールドを返します。EntryPoint v0.7 では `paymasterPostOpGasLimit` も返す必要があります。post-op の費用は Paymaster が負担するため、ウォレットの見積もりを信用できないからです。ウォレットが表示できる `sponsor` オブジェクト（`name`、任意の data URI 形式の `icon`）を返してもよく、2 回目の呼び出しが不要な場合は `isFinal: true` を返せます。\n- `pm_getPaymasterData` は、ガスの値が確定した後に実際の paymaster フィールド（v0.6 では `paymasterAndData`、v0.7 では `paymaster` + `paymasterData`）を返します。その後ユーザーが署名します。\n\nスタブデータは、最終データと同じ長さで、ゼロバイトが多くならず、`validatePaymasterUserOp`/`postOp` で同じコードパスをたどる必要があります。そうしないと `preVerificationGas` やガス上限が過小に見積もられます。\n\n**ウォレットの capability。** [EIP-5792](/eip-5792/) を土台にします。\n\n1. ウォレットは `wallet_getCapabilities` でチェーンごとに `paymasterService: { supported: true }` を通知します。\n2. アプリは `wallet_sendCalls` で `paymasterService: { url, context }` を渡します。\n3. ウォレットはスタブデータを呼び出し、自分の Bundler でガスを見積もり、paymaster データを呼び出し、ユーザーに署名を求めて送信します。\n\nガス見積もりは、どの Bundler を使うかをウォレットが知っているため、意図的にウォレット側に残されています。チェーン ID パラメーターにより、プロバイダーは望めば 1 つの URL で複数のチェーンに対応できます。\n\n## サンプルコード\n\nアプリ側、EIP-1193 プロバイダーを使用:\n\n```ts\nconst caps = await provider.request({\n  method: \"wallet_getCapabilities\",\n  params: [account],\n});\n\nif (caps[\"0x2105\"]?.paymasterService?.supported) {\n  await provider.request({\n    method: \"wallet_sendCalls\",\n    params: [{\n      version: \"1.0\",\n      chainId: \"0x2105\",\n      from: account,\n      calls: [{ to: target, value: \"0x0\", data: calldata }],\n      capabilities: {\n        paymasterService: {\n          url: \"https://my-app.example/api/paymaster\", // your backend proxy\n          context: { policyId: \"my-policy\" },          // provider-defined\n        },\n      },\n    }],\n  });\n}\n```\n\nEntryPoint v0.7 向けのスタブデータのレスポンス:\n\n```json\n{\n  \"sponsor\": { \"name\": \"My App\" },\n  \"paymaster\": \"0x...\",\n  \"paymasterData\": \"0x...\",\n  \"paymasterPostOpGasLimit\": \"0x...\"\n}\n```\n\n## 知っておくべきこと\n\n- ステータスは **Review** です。最終版になるまでにインターフェースが変わる可能性があります。\n- Paymaster プロバイダーの URL には API キーが含まれることがよくあります。仕様では、capability の向き先を自前のバックエンドにし、そこからプロバイダーへプロキシして、スポンサーする前に独自のチェックを適用できるようにすることを推奨しています。\n- ウォレットは（サービス障害時や、ユーザーがウォレット提供の Paymaster を選んだ場合に）あなたの Paymaster を無視することがあるため、アプリは自分の Paymaster が実際に支払ったと決めつけてはいけません。\n- スポンサーのアイコンを表示するウォレットは、埋め込みスクリプトが実行されないよう、SVG を `\u003cimg\u003e` タグで表示する必要があります。\n- Paymaster サービスは、スポンサーしない operation をスタブデータの段階で拒否すべきです。\n"},"ko":{"lang":"ko","tldr":"앱이 스마트 지갑에 어떤 paymaster 웹 서비스가 가스비를 후원할지 알려 줄 수 있게 하고, 지갑이 그 서비스와 통신하는 데 쓰는 두 개의 JSON-RPC 호출을 표준화한다.","tags":["account-abstraction","paymaster","wallet","gas-sponsorship","rpc"],"related":[4337,5792,7795],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7677/","markdown":"## 어떤 문제를 해결하나요?\n\n[ERC-4337](/eip-4337/) 스마트 계정에서는 *paymaster*가 사용자를 대신해 가스비를 낼 수 있습니다. 실제로 paymaster는 웹 서비스로 운영됩니다. 앱이 제공업체에 가입해 URL을 받는 식입니다. 하지만 앱이 사용자의 지갑에 \"이 호출들에는 이 paymaster를 써 달라\"고 알려 주는 표준 방법이 없었고, 제공업체마다 API가 조금씩 달라서 지갑이 이를 범용적으로 연동할 수 없었습니다.\n\nERC-7677은 두 가지를 모두 해결합니다. 앱이 지정한 paymaster URL을 전달하는 지갑 capability와, 모든 paymaster 서비스가 구현하는 공통의 두 메서드 API입니다.\n\n## 어떻게 동작하나요?\n\n**Paymaster 서비스 API.** 두 메서드 모두 같은 params `[userOp, entryPoint, chainId, context]`를 받습니다. user operation은 서명 전 상태이고, `context`에는 제공업체별 필드(예: 정책 ID)가 들어갑니다.\n\n- `pm_getPaymasterStubData`는 가스 추정에만 쓰이는 자리 표시용 paymaster 필드를 반환합니다. EntryPoint v0.7에서는 `paymasterPostOpGasLimit`도 반드시 반환해야 합니다. post-op 비용은 paymaster가 부담하므로 지갑의 추정치를 믿을 수 없기 때문입니다. 지갑이 표시할 수 있는 `sponsor` 객체(`name`, 선택적 data URI 형식의 `icon`)를 반환할 수 있고, 두 번째 호출이 필요 없다면 `isFinal: true`를 반환할 수 있습니다.\n- `pm_getPaymasterData`는 가스 값이 확정된 뒤 실제 paymaster 필드(v0.6은 `paymasterAndData`, v0.7은 `paymaster` + `paymasterData`)를 반환합니다. 이후 사용자가 서명합니다.\n\n스텁 데이터는 최종 데이터와 길이가 같아야 하고, 0 바이트가 더 많아서는 안 되며, `validatePaymasterUserOp`/`postOp`에서 같은 코드 경로를 거쳐야 합니다. 그렇지 않으면 `preVerificationGas`나 가스 한도가 과소 추정됩니다.\n\n**지갑 capability.** [EIP-5792](/eip-5792/)를 기반으로 합니다.\n\n1. 지갑은 `wallet_getCapabilities`에서 체인별로 `paymasterService: { supported: true }`를 알립니다.\n2. 앱은 `wallet_sendCalls`에 `paymasterService: { url, context }`를 전달합니다.\n3. 지갑은 스텁 데이터를 호출하고, 자신의 bundler로 가스를 추정하고, paymaster 데이터를 호출한 뒤, 사용자에게 서명을 요청하고 제출합니다.\n\n가스 추정은 지갑이 어떤 bundler를 쓸지 알고 있으므로 의도적으로 지갑에 맡겨져 있습니다. 체인 ID 파라미터 덕분에 제공업체는 원한다면 URL 하나로 여러 체인을 지원할 수 있습니다.\n\n## 샘플 코드\n\n앱 쪽, EIP-1193 provider 사용:\n\n```ts\nconst caps = await provider.request({\n  method: \"wallet_getCapabilities\",\n  params: [account],\n});\n\nif (caps[\"0x2105\"]?.paymasterService?.supported) {\n  await provider.request({\n    method: \"wallet_sendCalls\",\n    params: [{\n      version: \"1.0\",\n      chainId: \"0x2105\",\n      from: account,\n      calls: [{ to: target, value: \"0x0\", data: calldata }],\n      capabilities: {\n        paymasterService: {\n          url: \"https://my-app.example/api/paymaster\", // your backend proxy\n          context: { policyId: \"my-policy\" },          // provider-defined\n        },\n      },\n    }],\n  });\n}\n```\n\nEntryPoint v0.7용 스텁 데이터 응답:\n\n```json\n{\n  \"sponsor\": { \"name\": \"My App\" },\n  \"paymaster\": \"0x...\",\n  \"paymasterData\": \"0x...\",\n  \"paymasterPostOpGasLimit\": \"0x...\"\n}\n```\n\n## 알아둘 점\n\n- 상태는 **Review**입니다. 최종 확정 전에 인터페이스가 바뀔 수 있습니다.\n- paymaster 제공업체 URL에는 API 키가 들어 있는 경우가 많습니다. 스펙은 capability가 자체 백엔드를 가리키게 하고, 그 백엔드가 제공업체로 프록시하면서 후원 전에 자체 검사를 적용하도록 권장합니다.\n- 지갑은 (서비스 장애 시나 사용자가 지갑이 제공하는 paymaster를 선택한 경우) 여러분의 paymaster를 무시할 수 있으므로, 앱은 자신의 paymaster가 실제로 비용을 냈다고 가정해서는 안 됩니다.\n- 후원자 아이콘을 표시하는 지갑은 내장된 스크립트가 실행되지 않도록 SVG를 `\u003cimg\u003e` 태그로 렌더링해야 합니다.\n- paymaster 서비스는 후원하지 않을 operation을 스텁 데이터 단계에서 이미 거부해야 합니다.\n"},"zh":{"lang":"zh","tldr":"让应用告诉智能钱包应由哪个 paymaster Web 服务来赞助其 gas，并标准化钱包与该服务通信所用的两个 JSON-RPC 调用。","tags":["account-abstraction","paymaster","wallet","gas-sponsorship","rpc"],"related":[4337,5792,7795],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7677/","markdown":"## 它解决什么问题？\n\n在 [ERC-4337](/eip-4337/) 智能账户中，*paymaster* 可以代用户支付 gas。实践中 paymaster 以 Web 服务的形式运行：应用向提供商注册并获得一个 URL。但应用没有标准方式告诉用户的钱包\"这些调用请使用这个 paymaster\"，而且每家提供商暴露的 API 都略有不同，钱包因此无法通用地集成它们。\n\nERC-7677 同时解决了这两方面：一个携带应用所指定 paymaster URL 的钱包 capability，以及一套每个 paymaster 服务都要实现的通用双方法 API。\n\n## 它如何运作\n\n**Paymaster 服务 API。** 两个方法接收相同的参数：`[userOp, entryPoint, chainId, context]`。user operation 尚未签名，`context` 中是提供商特定的字段（例如策略 ID）。\n\n- `pm_getPaymasterStubData` 返回仅用于 gas 估算的占位 paymaster 字段。对于 EntryPoint v0.7，它还必须返回 `paymasterPostOpGasLimit`，因为 post-op 由 paymaster 付费，不能信任钱包的估算。它可以返回钱包可展示的 `sponsor` 对象（`name`，以及可选的 data URI 形式的 `icon`），如果不需要第二次调用，还可以返回 `isFinal: true`。\n- `pm_getPaymasterData` 在 gas 数值确定后返回真正的 paymaster 字段（v0.6 为 `paymasterAndData`，v0.7 为 `paymaster` + `paymasterData`）。随后用户签名。\n\nstub 数据必须与最终数据长度相同，零字节不能更多，并且在 `validatePaymasterUserOp`/`postOp` 中走相同的代码路径；否则 `preVerificationGas` 或 gas 上限会被低估。\n\n**钱包 capability。** 基于 [EIP-5792](/eip-5792/)：\n\n1. 钱包在 `wallet_getCapabilities` 中按链声明 `paymasterService: { supported: true }`。\n2. 应用在 `wallet_sendCalls` 中传入 `paymasterService: { url, context }`。\n3. 钱包调用 stub 数据，用自己的 bundler 估算 gas，调用 paymaster 数据，请用户签名，然后提交。\n\ngas 估算有意留给钱包，因为只有钱包知道自己会使用哪个 bundler。chain ID 参数让提供商可以按需用一个 URL 服务多条链。\n\n## 示例代码\n\n应用端，使用 EIP-1193 provider：\n\n```ts\nconst caps = await provider.request({\n  method: \"wallet_getCapabilities\",\n  params: [account],\n});\n\nif (caps[\"0x2105\"]?.paymasterService?.supported) {\n  await provider.request({\n    method: \"wallet_sendCalls\",\n    params: [{\n      version: \"1.0\",\n      chainId: \"0x2105\",\n      from: account,\n      calls: [{ to: target, value: \"0x0\", data: calldata }],\n      capabilities: {\n        paymasterService: {\n          url: \"https://my-app.example/api/paymaster\", // your backend proxy\n          context: { policyId: \"my-policy\" },          // provider-defined\n        },\n      },\n    }],\n  });\n}\n```\n\nEntryPoint v0.7 的 stub 数据响应：\n\n```json\n{\n  \"sponsor\": { \"name\": \"My App\" },\n  \"paymaster\": \"0x...\",\n  \"paymasterData\": \"0x...\",\n  \"paymasterPostOpGasLimit\": \"0x...\"\n}\n```\n\n## 需要注意\n\n- 状态为 **Review**：最终定稿前接口仍可能变化。\n- paymaster 提供商的 URL 通常包含 API 密钥。规范建议让 capability 指向你自己的后端，由后端代理到提供商，并可在赞助前执行自己的检查。\n- 钱包可能会忽略你的 paymaster（服务失败时，或用户选择了钱包自带的 paymaster），因此应用不能假定自己的 paymaster 确实付了费。\n- 展示赞助方图标的钱包必须用 `\u003cimg\u003e` 标签渲染 SVG，以免嵌入的脚本被执行。\n- paymaster 服务应在 stub 数据这一步就拒绝它们不愿赞助的操作。\n"}}}
