{"eip":2566,"title":"Human Readable Parameters for Contract Function Execution","description":"New Ethereum RPC method ethsendTransactionToContractFunction that parallels ethsendTransaction but allows for human-readable contract function execution data to be displayed to users.","authors":["Joseph Stockermans (@jstoxrocky)"],"status":"Stagnant","type":"Standards Track","category":"Interface","created":"2020-03-23","discussionsTo":"https://ethereum-magicians.org/t/human-readable-parameters-for-contract-function-execution/4154","repo":"EIPs","label":"EIP-2566","officialUrl":"https://eips.ethereum.org/EIPS/eip-2566","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2566.md","url":"https://eips.huatuo.xyz/eip-2566/","tldr":{"en":"Proposes a new RPC method, eth_sendTransactionToContractFunction, that sends the function's ABI alongside the calldata so wallets can show users exactly which function and arguments they are approving.","ja":"新しい RPC メソッド eth_sendTransactionToContractFunction を提案する。calldata と一緒に関数の ABI を送ることで、ウォレットがどの関数とどの引数を承認しようとしているのかをユーザーに正確に表示できる。","ko":"새로운 RPC 메서드 eth_sendTransactionToContractFunction을 제안한다. calldata와 함께 함수의 ABI를 보내, 지갑이 사용자가 승인하는 함수와 인자를 정확히 보여 줄 수 있게 한다.","zh":"提出一个新的 RPC 方法 eth_sendTransactionToContractFunction，在 calldata 之外同时发送函数的 ABI，让钱包能向用户准确展示他们批准的是哪个函数和哪些参数。"},"tags":["json-rpc","wallet","abi","ux","security"],"explainers":{"en":{"lang":"en","tldr":"Proposes a new RPC method, eth_sendTransactionToContractFunction, that sends the function's ABI alongside the calldata so wallets can show users exactly which function and arguments they are approving.","tags":["json-rpc","wallet","abi","ux","security"],"related":[1193,712,191],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-2566/","markdown":"## What problem does it solve?\n\nWhen a dapp asks a wallet to call a contract, it uses `eth_sendTransaction` with a `data` field: a 4-byte function selector (the first bytes of a keccak256 hash of the signature) followed by ABI-encoded arguments. That blob is not human-readable, and the selector can't be reversed into a function name, so the wallet often can't tell the user what is really being signed.\n\nThat gap is dangerous. A malicious or compromised dapp could, for example, swap the recipient in a token `transfer(address,uint256)` call, and a user glancing at hex data would never notice.\n\n## How it works\n\nThe proposal adds one JSON-RPC method that mirrors `eth_sendTransaction` and adds a single field:\n\n- `eth_sendTransactionToContractFunction` takes the usual transaction object (`from`, `to`, `gas`, `gasPrice`, `value`, `data`, `nonce`) **plus `abi`**, the ABI fragment for the function being called.\n- The wallet decodes the arguments in `data` using the types from `abi`, and shows the function name, parameter names and values in its confirmation screen.\n- The wallet can also recompute the selector from the ABI fragment and check that it matches the first four bytes of `data`, so a dapp can't attach a misleading ABI to different calldata.\n- Execution is unchanged: `data` is exactly what `eth_sendTransaction` would have sent, and the method returns the transaction hash.\n\nA new method was chosen instead of changing `eth_sendTransaction`, so existing code keeps working (the same reasoning [EIP-712](/eip-712/) used when it added `eth_signTypedData`).\n\n## Sample code\n\nA request as a dapp would send it through an [EIP-1193](/eip-1193/) provider (TypeScript, ethers v6 for encoding):\n\n```ts\nimport { Interface } from \"ethers\";\n\nconst fragment = {\n  type: \"function\",\n  name: \"transfer\",\n  stateMutability: \"nonpayable\",\n  inputs: [\n    { name: \"to\", type: \"address\" },\n    { name: \"value\", type: \"uint256\" },\n  ],\n  outputs: [{ name: \"\", type: \"bool\" }],\n};\n\nconst iface = new Interface([fragment]);\nconst data = iface.encodeFunctionData(\"transfer\", [recipient, 10n ** 18n]);\n\nconst txHash = await window.ethereum.request({\n  method: \"eth_sendTransactionToContractFunction\",\n  params: [{ from: account, to: tokenAddress, data, abi: JSON.stringify(fragment) }],\n});\n```\n\nWallet-side check that the ABI matches the calldata:\n\n```ts\nconst iface = new Interface([JSON.parse(params.abi)]);\nconst parsed = iface.parseTransaction({ data: params.data }); // null if selector mismatch\nif (!parsed) throw new Error(\"ABI does not match calldata\");\nconsole.log(parsed.name, parsed.args); // show to the user\n```\n\n## Things to know\n\n- **Status: Stagnant.** The method is not part of the standard Ethereum JSON-RPC API, so don't expect wallets to support it.\n- In practice wallets solved the same problem differently: decoding calldata with ABIs fetched from verified-source databases or signature registries, and simulating transactions before signing.\n- As the spec itself notes, a readable function name is not proof of safety. A contract can name a function `transfer` and do anything; this only shows what is being called, not what the code does.\n"},"ja":{"lang":"ja","tldr":"新しい RPC メソッド eth_sendTransactionToContractFunction を提案する。calldata と一緒に関数の ABI を送ることで、ウォレットがどの関数とどの引数を承認しようとしているのかをユーザーに正確に表示できる。","tags":["json-rpc","wallet","abi","ux","security"],"related":[1193,712,191],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-2566/","markdown":"## 何を解決するのか\n\ndapp がウォレットにコントラクト呼び出しを依頼するとき、`data` フィールド付きの `eth_sendTransaction` を使います。これは 4 バイトの関数セレクター（シグネチャの keccak256 ハッシュの先頭バイト）に続けて ABI エンコードされた引数を並べたものです。このデータの塊は人間には読めず、セレクターから関数名を逆引きすることもできないため、ウォレットは何に署名しようとしているのかをユーザーに伝えられないことがよくあります。\n\nこのギャップは危険です。悪意のある、あるいは乗っ取られた dapp が、たとえばトークンの `transfer(address,uint256)` 呼び出しの受取人をすり替えても、16 進数のデータをちらっと見るだけのユーザーは気づけません。\n\n## 仕組み\n\nこの提案は、`eth_sendTransaction` に対応する JSON-RPC メソッドを 1 つ追加し、フィールドを 1 つ足します。\n\n- `eth_sendTransactionToContractFunction` は、通常のトランザクションオブジェクト（`from`、`to`、`gas`、`gasPrice`、`value`、`data`、`nonce`）**に加えて `abi`**、つまり呼び出される関数の ABI フラグメントを受け取ります。\n- ウォレットは `abi` の型を使って `data` の引数をデコードし、確認画面に関数名、パラメータ名、値を表示します。\n- ウォレットは ABI フラグメントからセレクターを再計算し、`data` の先頭 4 バイトと一致するかどうかも確認できるため、dapp が別の calldata に紛らわしい ABI を付けることはできません。\n- 実行は変わりません。`data` は `eth_sendTransaction` が送るものとまったく同じで、メソッドはトランザクションハッシュを返します。\n\n`eth_sendTransaction` を変更するのではなく新しいメソッドが選ばれたのは、既存のコードが動き続けるようにするためです（[EIP-712](/eip-712/) が `eth_signTypedData` を追加したときと同じ理由です）。\n\n## サンプルコード\n\ndapp が [EIP-1193](/eip-1193/) プロバイダー経由で送るリクエストの例（TypeScript、エンコードには ethers v6）:\n\n```ts\nimport { Interface } from \"ethers\";\n\nconst fragment = {\n  type: \"function\",\n  name: \"transfer\",\n  stateMutability: \"nonpayable\",\n  inputs: [\n    { name: \"to\", type: \"address\" },\n    { name: \"value\", type: \"uint256\" },\n  ],\n  outputs: [{ name: \"\", type: \"bool\" }],\n};\n\nconst iface = new Interface([fragment]);\nconst data = iface.encodeFunctionData(\"transfer\", [recipient, 10n ** 18n]);\n\nconst txHash = await window.ethereum.request({\n  method: \"eth_sendTransactionToContractFunction\",\n  params: [{ from: account, to: tokenAddress, data, abi: JSON.stringify(fragment) }],\n});\n```\n\nABI が calldata と一致することを確認するウォレット側のチェック:\n\n```ts\nconst iface = new Interface([JSON.parse(params.abi)]);\nconst parsed = iface.parseTransaction({ data: params.data }); // null if selector mismatch\nif (!parsed) throw new Error(\"ABI does not match calldata\");\nconsole.log(parsed.name, parsed.args); // show to the user\n```\n\n## 知っておくべきこと\n\n- **ステータス：Stagnant。** このメソッドは標準の Ethereum JSON-RPC API には含まれていないので、ウォレットが対応しているとは期待しないでください。\n- 実際には、ウォレットは同じ問題を別の方法で解決しました。検証済みソースのデータベースやシグネチャレジストリから取得した ABI で calldata をデコードしたり、署名前にトランザクションをシミュレートしたりしています。\n- 仕様自身が述べているように、読める関数名は安全の証明ではありません。コントラクトは関数に `transfer` と名付けて何でもできます。これが示すのは何が呼ばれているかであって、コードが何をするかではありません。\n"},"ko":{"lang":"ko","tldr":"새로운 RPC 메서드 eth_sendTransactionToContractFunction을 제안한다. calldata와 함께 함수의 ABI를 보내, 지갑이 사용자가 승인하는 함수와 인자를 정확히 보여 줄 수 있게 한다.","tags":["json-rpc","wallet","abi","ux","security"],"related":[1193,712,191],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-2566/","markdown":"## 어떤 문제를 해결하나요?\n\ndapp이 지갑에 컨트랙트 호출을 요청할 때는 `data` 필드가 있는 `eth_sendTransaction`을 씁니다. 4바이트 함수 셀렉터(시그니처의 keccak256 해시 앞부분)에 ABI 인코딩된 인자가 이어지는 형태입니다. 이 덩어리는 사람이 읽을 수 없고, 셀렉터에서 함수 이름을 거꾸로 알아낼 수도 없어서, 지갑이 사용자에게 실제로 무엇에 서명하는지 알려 주지 못하는 경우가 많습니다.\n\n이 간극은 위험합니다. 악의적이거나 침해된 dapp이 예를 들어 토큰 `transfer(address,uint256)` 호출의 수신자를 바꿔치기해도, 16진수 데이터를 흘끗 보는 사용자는 결코 알아차리지 못합니다.\n\n## 어떻게 동작하나요?\n\n이 제안은 `eth_sendTransaction`을 그대로 따르면서 필드 하나를 추가한 JSON-RPC 메서드 하나를 더합니다.\n\n- `eth_sendTransactionToContractFunction`은 일반적인 트랜잭션 객체(`from`, `to`, `gas`, `gasPrice`, `value`, `data`, `nonce`) **그리고 `abi`**, 즉 호출되는 함수의 ABI 조각을 받습니다.\n- 지갑은 `abi`의 타입으로 `data`의 인자를 디코딩하고, 확인 화면에 함수 이름, 파라미터 이름, 값을 보여 줍니다.\n- 지갑은 ABI 조각으로 셀렉터를 다시 계산해 `data`의 처음 4바이트와 일치하는지도 확인할 수 있으므로, dapp이 다른 calldata에 오해를 부르는 ABI를 붙일 수 없습니다.\n- 실행은 달라지지 않습니다. `data`는 `eth_sendTransaction`이 보냈을 것과 정확히 같고, 이 메서드는 트랜잭션 해시를 반환합니다.\n\n`eth_sendTransaction`을 바꾸는 대신 새 메서드를 선택한 것은 기존 코드가 계속 동작하도록 하기 위해서입니다([EIP-712](/eip-712/)가 `eth_signTypedData`를 추가할 때 사용한 것과 같은 논리입니다).\n\n## 샘플 코드\n\ndapp이 [EIP-1193](/eip-1193/) provider를 통해 보내는 요청의 예(TypeScript, 인코딩에는 ethers v6):\n\n```ts\nimport { Interface } from \"ethers\";\n\nconst fragment = {\n  type: \"function\",\n  name: \"transfer\",\n  stateMutability: \"nonpayable\",\n  inputs: [\n    { name: \"to\", type: \"address\" },\n    { name: \"value\", type: \"uint256\" },\n  ],\n  outputs: [{ name: \"\", type: \"bool\" }],\n};\n\nconst iface = new Interface([fragment]);\nconst data = iface.encodeFunctionData(\"transfer\", [recipient, 10n ** 18n]);\n\nconst txHash = await window.ethereum.request({\n  method: \"eth_sendTransactionToContractFunction\",\n  params: [{ from: account, to: tokenAddress, data, abi: JSON.stringify(fragment) }],\n});\n```\n\nABI가 calldata와 일치하는지 확인하는 지갑 측 검사:\n\n```ts\nconst iface = new Interface([JSON.parse(params.abi)]);\nconst parsed = iface.parseTransaction({ data: params.data }); // null if selector mismatch\nif (!parsed) throw new Error(\"ABI does not match calldata\");\nconsole.log(parsed.name, parsed.args); // show to the user\n```\n\n## 알아둘 점\n\n- **상태: Stagnant.** 이 메서드는 표준 이더리움 JSON-RPC API에 속하지 않으므로, 지갑이 지원하리라고 기대하지 마세요.\n- 실제로 지갑들은 같은 문제를 다른 방식으로 해결했습니다. 검증된 소스 데이터베이스나 시그니처 레지스트리에서 가져온 ABI로 calldata를 디코딩하고, 서명 전에 트랜잭션을 시뮬레이션하는 것입니다.\n- 명세 스스로 언급하듯이, 읽을 수 있는 함수 이름이 안전의 증거는 아닙니다. 컨트랙트는 함수 이름을 `transfer`라고 짓고 무엇이든 할 수 있습니다. 이것은 무엇이 호출되는지만 보여 줄 뿐, 코드가 무엇을 하는지는 보여 주지 않습니다.\n"},"zh":{"lang":"zh","tldr":"提出一个新的 RPC 方法 eth_sendTransactionToContractFunction，在 calldata 之外同时发送函数的 ABI，让钱包能向用户准确展示他们批准的是哪个函数和哪些参数。","tags":["json-rpc","wallet","abi","ux","security"],"related":[1193,712,191],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-2566/","markdown":"## 它解决什么问题？\n\n当 dapp 请求钱包调用合约时，使用的是带有 `data` 字段的 `eth_sendTransaction`：一个 4 字节的函数选择器（签名的 keccak256 哈希的前几个字节），后面跟着 ABI 编码的参数。这段数据人类无法阅读，选择器也无法反推出函数名，所以钱包往往无法告诉用户到底在签署什么。\n\n这个缺口很危险。恶意或被攻破的 dapp 可以，比如，替换代币 `transfer(address,uint256)` 调用中的收款人，而只瞥一眼十六进制数据的用户永远不会发现。\n\n## 它如何运作\n\n该提案新增一个镜像 `eth_sendTransaction` 的 JSON-RPC 方法，并增加一个字段：\n\n- `eth_sendTransactionToContractFunction` 接受通常的交易对象（`from`、`to`、`gas`、`gasPrice`、`value`、`data`、`nonce`）**外加 `abi`**，即被调用函数的 ABI 片段。\n- 钱包用 `abi` 中的类型解码 `data` 里的参数，并在确认界面显示函数名、参数名和参数值。\n- 钱包还可以根据 ABI 片段重新计算选择器，并检查它是否与 `data` 的前四个字节一致，这样 dapp 就不能给不同的 calldata 附上误导性的 ABI。\n- 执行不变：`data` 与 `eth_sendTransaction` 会发送的完全一样，该方法返回交易哈希。\n\n之所以选择新增方法而不是修改 `eth_sendTransaction`，是为了让现有代码继续可用（[EIP-712](/eip-712/) 增加 `eth_signTypedData` 时也是同样的考虑）。\n\n## 示例代码\n\ndapp 通过 [EIP-1193](/eip-1193/) provider 发送的请求（TypeScript，使用 ethers v6 编码）：\n\n```ts\nimport { Interface } from \"ethers\";\n\nconst fragment = {\n  type: \"function\",\n  name: \"transfer\",\n  stateMutability: \"nonpayable\",\n  inputs: [\n    { name: \"to\", type: \"address\" },\n    { name: \"value\", type: \"uint256\" },\n  ],\n  outputs: [{ name: \"\", type: \"bool\" }],\n};\n\nconst iface = new Interface([fragment]);\nconst data = iface.encodeFunctionData(\"transfer\", [recipient, 10n ** 18n]);\n\nconst txHash = await window.ethereum.request({\n  method: \"eth_sendTransactionToContractFunction\",\n  params: [{ from: account, to: tokenAddress, data, abi: JSON.stringify(fragment) }],\n});\n```\n\n钱包端检查 ABI 与 calldata 是否匹配：\n\n```ts\nconst iface = new Interface([JSON.parse(params.abi)]);\nconst parsed = iface.parseTransaction({ data: params.data }); // null if selector mismatch\nif (!parsed) throw new Error(\"ABI does not match calldata\");\nconsole.log(parsed.name, parsed.args); // show to the user\n```\n\n## 需要注意\n\n- **状态：Stagnant。** 该方法不属于标准的以太坊 JSON-RPC API，因此不要指望钱包支持它。\n- 实际上钱包用另一种方式解决了同样的问题：用从已验证源码数据库或签名注册表获取的 ABI 解码 calldata，并在签名前模拟交易。\n- 正如规范自己所指出的，可读的函数名并不等于安全。合约可以把函数命名为 `transfer` 却做任何事；这只能显示正在调用什么，而不是代码实际做了什么。\n"}}}
