{"eip":1077,"title":"Gas relay for contract calls","description":"A standard interface for gas abstraction in top of smart contracts.","authors":["Alex Van de Sande \u003cavsa@ethereum.org\u003e","Ricardo Guilherme Schmidt (@3esmit)"],"status":"Stagnant","type":"Standards Track","category":"ERC","created":"2018-05-04","requires":[20,191,1271,1344],"discussionsTo":"https://ethereum-magicians.org/t/erc1077-and-1078-the-magic-of-executable-signed-messages-to-login-and-do-actions/351","repo":"ERCs","label":"ERC-1077","officialUrl":"https://eips.ethereum.org/EIPS/eip-1077","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1077.md","url":"https://eips.huatuo.xyz/eip-1077/","tldr":{"en":"An early meta-transaction interface for account contracts: the user signs a message, a relayer submits it and pays the ETH gas, and the contract reimburses the relayer in a token.","ja":"アカウントコントラクト向けの初期のメタトランザクションインターフェース。ユーザーがメッセージに署名し、リレイヤーがそれを送信して ETH のガス代を支払い、コントラクトがリレイヤーにトークンで払い戻す。","ko":"계정 컨트랙트를 위한 초기 메타 트랜잭션 인터페이스. 사용자가 메시지에 서명하면 릴레이어가 이를 제출하고 ETH 가스비를 내며, 컨트랙트가 릴레이어에게 토큰으로 상환한다.","zh":"面向账户合约的早期元交易接口：用户签署消息，中继者提交消息并支付 ETH gas 费，账户合约再用代币补偿中继者。"},"tags":["meta-transactions","gas-abstraction","relayer","account-contract","signatures"],"explainers":{"en":{"lang":"en","tldr":"An early meta-transaction interface for account contracts: the user signs a message, a relayer submits it and pays the ETH gas, and the contract reimburses the relayer in a token.","tags":["meta-transactions","gas-abstraction","relayer","account-contract","signatures"],"related":[191,1271,1344,2771,4337],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-1077/","markdown":"## What problem does it solve?\n\nEvery Ethereum transaction has to be paid for in ETH. For a new user that is a real barrier: before they can touch an app they must buy ETH, even if the app's own token is all they care about.\n\nERC-1077 standardises a workaround. The user's funds live in an **account contract** (an early smart-contract wallet). The user only *signs a message* describing what they want to do. Anyone holding ETH, a **relayer**, can submit that message in a real transaction, and the account contract pays the relayer back for the gas, in ETH or in an ERC-20 token the two sides agreed on.\n\n## How it works\n\nThe account contract exposes:\n\n| Function | Purpose |\n| --- | --- |\n| `executeGasRelay(execData, gasPrice, gasLimit, gasToken, gasRelayer, signature)` | Verify the signature, run `execData`, pay the relayer |\n| `executeGasRelayMsg(...)` | Build the raw message to be signed |\n| `executeGasRelayERC191Msg(...)` | Same message wrapped in [EIP-191](/eip-191/) format |\n| `lastNonce()` | Current nonce for relayed messages |\n\nThe signed message covers: the account address, the chain ID ([EIP-1344](/eip-1344/)), the function selector, a nonce, the call data to execute, the gas price (denominated in the chosen token), a gas limit, the gas token (zero address for ETH) and the relayer allowed to collect the refund (zero for `block.coinbase`).\n\nSignature checking goes through [ERC-1271](/eip-1271/), so the owner of the account can itself be a contract such as a multisig.\n\nThe contract measures gas used around the call and transfers `gasSpent * gasPrice` of the gas token to the relayer. If the inner call fails, the nonce is still consumed and the relayer is still paid, so relayers are not punished for a user's failed action. If funds are insufficient or the gas limit is exceeded, the whole transaction reverts.\n\n## Sample code\n\nBuilding the hash the user signs, as the spec defines it (Solidity 0.8 syntax):\n\n```solidity\nfunction gasRelayHash(\n    uint256 nonce,\n    bytes memory execData,\n    uint256 gasPrice,\n    uint256 gasLimit,\n    address gasToken,\n    address gasRelayer\n) public view returns (bytes32) {\n    return keccak256(\n        abi.encodePacked(\n            bytes1(0x19),          // EIP-191 prefix\n            bytes1(0x00),          // EIP-191 version 0\n            address(this),         // validator = this account contract\n            block.chainid,\n            bytes4(keccak256(\"executeGasRelay(uint256,bytes,uint256,uint256,address,address)\")),\n            nonce,\n            execData,\n            gasPrice,\n            gasLimit,\n            gasToken,\n            gasRelayer\n        )\n    );\n}\n```\n\nThe same hash off-chain (ethers v6), signed by a device key:\n\n```ts\nimport { solidityPackedKeccak256, id, dataSlice, Wallet } from \"ethers\";\n\nconst hash = solidityPackedKeccak256(\n  [\"bytes1\", \"bytes1\", \"address\", \"uint256\", \"bytes4\", \"uint256\", \"bytes\", \"uint256\", \"uint256\", \"address\", \"address\"],\n  [\"0x19\", \"0x00\", account, chainId,\n   dataSlice(id(\"executeGasRelay(uint256,bytes,uint256,uint256,address,address)\"), 0, 4),\n   nonce, execData, gasPrice, gasLimit, gasToken, relayer],\n);\nconst signature = new Wallet(deviceKey).signingKey.sign(hash).serialized;\n```\n\n## Things to know\n\n- Status is **Stagnant**. It never became a widely adopted standard, and the account-contract interface itself was left out of scope.\n- Relayers take on risk: an account contract might not actually refund them. The spec tells relayers to simulate a call before submitting it and to keep their own reputation list of contracts and tokens.\n- Today the same goals are usually met with [ERC-2771](/eip-2771/) (trusted forwarders), [ERC-4337](/eip-4337/) (account abstraction with paymasters) or [EIP-7702](/eip-7702/) for EOAs.\n- The ideas here (device keys, paying gas in tokens, apps sponsoring users) fed directly into later smart-wallet designs.\n"},"ja":{"lang":"ja","tldr":"アカウントコントラクト向けの初期のメタトランザクションインターフェース。ユーザーがメッセージに署名し、リレイヤーがそれを送信して ETH のガス代を支払い、コントラクトがリレイヤーにトークンで払い戻す。","tags":["meta-transactions","gas-abstraction","relayer","account-contract","signatures"],"related":[191,1271,1344,2771,4337],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-1077/","markdown":"## 何を解決するのか\n\nEthereum のトランザクションは、すべて ETH で支払う必要があります。新規ユーザーにとってこれは大きな障壁です。アプリ自身のトークンだけが目当てであっても、アプリに触れる前に ETH を購入しなければなりません。\n\nERC-1077 は、これを回避する方法を標準化します。ユーザーの資金は**アカウントコントラクト**（初期のスマートコントラクトウォレット）に置かれます。ユーザーは、やりたいことを記述したメッセージに*署名するだけ*です。ETH を持つ誰か、つまり**リレイヤー**が、そのメッセージを実際のトランザクションで送信でき、アカウントコントラクトは、双方が合意した ETH または ERC-20 トークンで、ガス代をリレイヤーに払い戻します。\n\n## 仕組み\n\nアカウントコントラクトは次を公開します。\n\n| 関数 | 役割 |\n| --- | --- |\n| `executeGasRelay(execData, gasPrice, gasLimit, gasToken, gasRelayer, signature)` | 署名を検証し、`execData` を実行し、リレイヤーに支払う |\n| `executeGasRelayMsg(...)` | 署名対象となる生のメッセージを組み立てる |\n| `executeGasRelayERC191Msg(...)` | 同じメッセージを [EIP-191](/eip-191/) 形式で包んだもの |\n| `lastNonce()` | リレーされるメッセージの現在の nonce |\n\n署名されるメッセージには、次が含まれます。アカウントのアドレス、チェーン ID（[EIP-1344](/eip-1344/)）、関数セレクター、nonce、実行する呼び出しデータ、ガス価格（選択したトークン建て）、ガスリミット、ガストークン（ETH ならゼロアドレス）、そして払い戻しを受け取れるリレイヤー（`block.coinbase` ならゼロ）です。\n\n署名の検証は [ERC-1271](/eip-1271/) を経由するため、アカウントの所有者自体がマルチシグのようなコントラクトでもかまいません。\n\nコントラクトは呼び出しの前後で使用したガスを計測し、`gasSpent * gasPrice` 分のガストークンをリレイヤーに転送します。内部の呼び出しが失敗しても、nonce は消費され、リレイヤーには支払いが行われるため、ユーザーの操作が失敗してもリレイヤーは不利益を被りません。資金が不足している場合やガスリミットを超過した場合は、トランザクション全体がリバートされます。\n\n## サンプルコード\n\nユーザーが署名するハッシュを、仕様書の定義どおりに組み立てる例（Solidity 0.8 構文）:\n\n```solidity\nfunction gasRelayHash(\n    uint256 nonce,\n    bytes memory execData,\n    uint256 gasPrice,\n    uint256 gasLimit,\n    address gasToken,\n    address gasRelayer\n) public view returns (bytes32) {\n    return keccak256(\n        abi.encodePacked(\n            bytes1(0x19),          // EIP-191 prefix\n            bytes1(0x00),          // EIP-191 version 0\n            address(this),         // validator = this account contract\n            block.chainid,\n            bytes4(keccak256(\"executeGasRelay(uint256,bytes,uint256,uint256,address,address)\")),\n            nonce,\n            execData,\n            gasPrice,\n            gasLimit,\n            gasToken,\n            gasRelayer\n        )\n    );\n}\n```\n\n同じハッシュをオフチェーンで計算し（ethers v6）、デバイスキーで署名する例:\n\n```ts\nimport { solidityPackedKeccak256, id, dataSlice, Wallet } from \"ethers\";\n\nconst hash = solidityPackedKeccak256(\n  [\"bytes1\", \"bytes1\", \"address\", \"uint256\", \"bytes4\", \"uint256\", \"bytes\", \"uint256\", \"uint256\", \"address\", \"address\"],\n  [\"0x19\", \"0x00\", account, chainId,\n   dataSlice(id(\"executeGasRelay(uint256,bytes,uint256,uint256,address,address)\"), 0, 4),\n   nonce, execData, gasPrice, gasLimit, gasToken, relayer],\n);\nconst signature = new Wallet(deviceKey).signingKey.sign(hash).serialized;\n```\n\n## 知っておくべきこと\n\n- ステータスは **Stagnant** です。広く採用された標準にはならず、アカウントコントラクトのインターフェース自体も対象範囲外とされていました。\n- リレイヤーにはリスクがあります。アカウントコントラクトが実際には払い戻さない可能性があるからです。仕様書は、リレイヤーに対して、送信前に呼び出しをシミュレーションし、コントラクトとトークンについて独自の評判リストを持つように述べています。\n- 現在では、同じ目的を通常は [ERC-2771](/eip-2771/)（信頼されたフォワーダー）、[ERC-4337](/eip-4337/)（Paymaster を使ったアカウント抽象化）、または EOA 向けの [EIP-7702](/eip-7702/) で実現しています。\n- ここにあるアイデア（デバイスキー、トークンでのガス支払い、アプリによるユーザーのスポンサー）は、のちのスマートウォレット設計に直接つながりました。\n"},"ko":{"lang":"ko","tldr":"계정 컨트랙트를 위한 초기 메타 트랜잭션 인터페이스. 사용자가 메시지에 서명하면 릴레이어가 이를 제출하고 ETH 가스비를 내며, 컨트랙트가 릴레이어에게 토큰으로 상환한다.","tags":["meta-transactions","gas-abstraction","relayer","account-contract","signatures"],"related":[191,1271,1344,2771,4337],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-1077/","markdown":"## 어떤 문제를 해결하나요?\n\n이더리움의 모든 트랜잭션은 ETH로 비용을 내야 합니다. 신규 사용자에게는 이것이 실제 진입 장벽입니다. 앱 자체 토큰만 필요하더라도 앱을 쓰기 전에 먼저 ETH를 사야 합니다.\n\nERC-1077은 이를 우회하는 방법을 표준화합니다. 사용자의 자금은 **계정 컨트랙트**(초기 스마트 컨트랙트 지갑)에 들어 있습니다. 사용자는 하고 싶은 일을 설명하는 메시지에 *서명만* 합니다. ETH를 가진 누구든, 즉 **릴레이어**(relayer)가 그 메시지를 실제 트랜잭션에 담아 제출할 수 있고, 계정 컨트랙트는 양측이 합의한 ETH 또는 ERC-20 토큰으로 릴레이어에게 가스비를 갚아 줍니다.\n\n## 어떻게 동작하나요?\n\n계정 컨트랙트는 다음을 노출합니다.\n\n| 함수 | 역할 |\n| --- | --- |\n| `executeGasRelay(execData, gasPrice, gasLimit, gasToken, gasRelayer, signature)` | 서명을 검증하고, `execData`를 실행하고, 릴레이어에게 지급 |\n| `executeGasRelayMsg(...)` | 서명할 원시 메시지를 구성 |\n| `executeGasRelayERC191Msg(...)` | 같은 메시지를 [EIP-191](/eip-191/) 형식으로 감싼 것 |\n| `lastNonce()` | 릴레이되는 메시지의 현재 nonce |\n\n서명되는 메시지에는 다음이 포함됩니다. 계정 주소, 체인 ID([EIP-1344](/eip-1344/)), 함수 셀렉터, nonce, 실행할 호출 데이터, 가스 가격(선택한 토큰 단위), 가스 한도, 가스 토큰(ETH면 제로 주소), 그리고 상환금을 받을 수 있는 릴레이어(`block.coinbase`면 0)입니다.\n\n서명 검증은 [ERC-1271](/eip-1271/)을 거치므로, 계정의 소유자 자체가 멀티시그 같은 컨트랙트여도 됩니다.\n\n컨트랙트는 호출 전후로 사용한 가스를 측정하고 `gasSpent * gasPrice`만큼의 가스 토큰을 릴레이어에게 전송합니다. 내부 호출이 실패해도 nonce는 소비되고 릴레이어는 여전히 지급받으므로, 사용자의 동작이 실패해도 릴레이어가 불이익을 받지 않습니다. 자금이 부족하거나 가스 한도를 넘으면 트랜잭션 전체가 리버트됩니다.\n\n## 샘플 코드\n\n사용자가 서명하는 해시를 명세서의 정의대로 구성하기(Solidity 0.8 문법):\n\n```solidity\nfunction gasRelayHash(\n    uint256 nonce,\n    bytes memory execData,\n    uint256 gasPrice,\n    uint256 gasLimit,\n    address gasToken,\n    address gasRelayer\n) public view returns (bytes32) {\n    return keccak256(\n        abi.encodePacked(\n            bytes1(0x19),          // EIP-191 prefix\n            bytes1(0x00),          // EIP-191 version 0\n            address(this),         // validator = this account contract\n            block.chainid,\n            bytes4(keccak256(\"executeGasRelay(uint256,bytes,uint256,uint256,address,address)\")),\n            nonce,\n            execData,\n            gasPrice,\n            gasLimit,\n            gasToken,\n            gasRelayer\n        )\n    );\n}\n```\n\n같은 해시를 오프체인에서 계산하고(ethers v6) 디바이스 키로 서명하기:\n\n```ts\nimport { solidityPackedKeccak256, id, dataSlice, Wallet } from \"ethers\";\n\nconst hash = solidityPackedKeccak256(\n  [\"bytes1\", \"bytes1\", \"address\", \"uint256\", \"bytes4\", \"uint256\", \"bytes\", \"uint256\", \"uint256\", \"address\", \"address\"],\n  [\"0x19\", \"0x00\", account, chainId,\n   dataSlice(id(\"executeGasRelay(uint256,bytes,uint256,uint256,address,address)\"), 0, 4),\n   nonce, execData, gasPrice, gasLimit, gasToken, relayer],\n);\nconst signature = new Wallet(deviceKey).signingKey.sign(hash).serialized;\n```\n\n## 알아둘 점\n\n- 상태는 **Stagnant**입니다. 널리 채택된 표준이 되지 못했고, 계정 컨트랙트 인터페이스 자체도 범위에서 제외되었습니다.\n- 릴레이어는 위험을 떠안습니다. 계정 컨트랙트가 실제로는 상환하지 않을 수 있기 때문입니다. 명세서는 릴레이어에게 제출하기 전에 호출을 시뮬레이션하고, 컨트랙트와 토큰에 대한 자체 평판 목록을 유지하라고 말합니다.\n- 오늘날 같은 목표는 보통 [ERC-2771](/eip-2771/)(신뢰하는 포워더), [ERC-4337](/eip-4337/)(Paymaster를 쓰는 계정 추상화), 또는 EOA용 [EIP-7702](/eip-7702/)로 달성합니다.\n- 여기 담긴 아이디어(디바이스 키, 토큰으로 가스 지불, 앱이 사용자를 후원)는 이후 스마트 지갑 설계에 직접 영향을 주었습니다.\n"},"zh":{"lang":"zh","tldr":"面向账户合约的早期元交易接口：用户签署消息，中继者提交消息并支付 ETH gas 费，账户合约再用代币补偿中继者。","tags":["meta-transactions","gas-abstraction","relayer","account-contract","signatures"],"related":[191,1271,1344,2771,4337],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-1077/","markdown":"## 它解决什么问题？\n\n以太坊的每笔交易都必须用 ETH 支付。对新用户来说，这是一道真正的门槛：即使他们只关心应用自己的代币，在接触应用之前也必须先购买 ETH。\n\nERC-1077 把一种变通办法标准化了。用户的资金存放在**账户合约**（早期的智能合约钱包）中。用户只需*签署一条消息*来描述自己想做的事。任何持有 ETH 的人，即**中继者**（relayer），都可以把这条消息放进一笔真实的交易提交出去，账户合约则用 ETH 或双方约定的 ERC-20 代币把 gas 费补偿给中继者。\n\n## 它如何运作\n\n账户合约提供：\n\n| 函数 | 用途 |\n| --- | --- |\n| `executeGasRelay(execData, gasPrice, gasLimit, gasToken, gasRelayer, signature)` | 验证签名、执行 `execData`、向中继者付款 |\n| `executeGasRelayMsg(...)` | 构造待签署的原始消息 |\n| `executeGasRelayERC191Msg(...)` | 同一条消息，按 [EIP-191](/eip-191/) 格式包装 |\n| `lastNonce()` | 被中继消息的当前 nonce |\n\n被签署的消息涵盖：账户地址、链 ID（[EIP-1344](/eip-1344/)）、函数选择器、nonce、要执行的调用数据、gas 价格（以所选代币计价）、gas 上限、gas 代币（ETH 则为零地址），以及有权领取补偿的中继者（零地址表示 `block.coinbase`）。\n\n签名验证经由 [ERC-1271](/eip-1271/) 完成，因此账户的所有者本身也可以是多签之类的合约。\n\n合约会在调用前后测量所用的 gas，并把 `gasSpent * gasPrice` 数量的 gas 代币转给中继者。如果内部调用失败，nonce 仍会被消耗，中继者仍会得到付款，因此中继者不会因用户的操作失败而受到惩罚。如果资金不足或超出 gas 上限，整笔交易会回滚。\n\n## 示例代码\n\n按规范的定义构造用户签署的哈希（Solidity 0.8 语法）：\n\n```solidity\nfunction gasRelayHash(\n    uint256 nonce,\n    bytes memory execData,\n    uint256 gasPrice,\n    uint256 gasLimit,\n    address gasToken,\n    address gasRelayer\n) public view returns (bytes32) {\n    return keccak256(\n        abi.encodePacked(\n            bytes1(0x19),          // EIP-191 prefix\n            bytes1(0x00),          // EIP-191 version 0\n            address(this),         // validator = this account contract\n            block.chainid,\n            bytes4(keccak256(\"executeGasRelay(uint256,bytes,uint256,uint256,address,address)\")),\n            nonce,\n            execData,\n            gasPrice,\n            gasLimit,\n            gasToken,\n            gasRelayer\n        )\n    );\n}\n```\n\n在链下计算同一个哈希（ethers v6），并用设备密钥签名：\n\n```ts\nimport { solidityPackedKeccak256, id, dataSlice, Wallet } from \"ethers\";\n\nconst hash = solidityPackedKeccak256(\n  [\"bytes1\", \"bytes1\", \"address\", \"uint256\", \"bytes4\", \"uint256\", \"bytes\", \"uint256\", \"uint256\", \"address\", \"address\"],\n  [\"0x19\", \"0x00\", account, chainId,\n   dataSlice(id(\"executeGasRelay(uint256,bytes,uint256,uint256,address,address)\"), 0, 4),\n   nonce, execData, gasPrice, gasLimit, gasToken, relayer],\n);\nconst signature = new Wallet(deviceKey).signingKey.sign(hash).serialized;\n```\n\n## 需要注意\n\n- 状态为 **Stagnant**。它从未成为被广泛采用的标准，账户合约接口本身也被排除在范围之外。\n- 中继者要承担风险：账户合约可能并不会真正补偿他们。规范建议中继者在提交之前先模拟一次调用，并自行维护一份合约和代币的信誉名单。\n- 如今同样的目标通常由 [ERC-2771](/eip-2771/)（受信转发器）、[ERC-4337](/eip-4337/)（带 Paymaster 的账户抽象）或面向 EOA 的 [EIP-7702](/eip-7702/) 来实现。\n- 这里的思路（设备密钥、用代币支付 gas、应用为用户代付）直接影响了后来的智能钱包设计。\n"}},"requiredBy":[1078]}
