{"eip":1202,"title":"Voting Interface","description":"A general interface for voting on-chain","authors":["Zainan Victor Zhou (@xinbenlv)","ERC-1202 Working Group \u003cerc1202@googlegroups.com\u003e"],"status":"Review","type":"Standards Track","category":"ERC","created":"2018-07-08","requires":[5269],"discussionsTo":"https://ethereum-magicians.org/t/eip-1202-voting-interface/11484","repo":"ERCs","label":"ERC-1202","officialUrl":"https://eips.ethereum.org/EIPS/eip-1202","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1202.md","url":"https://eips.huatuo.xyz/eip-1202/","tldr":{"en":"A minimal standard interface for casting on-chain votes on a proposal ID, so voting UIs and DAOs can work with any compliant voting contract.","ja":"提案 ID に対するオンチェーン投票を行うための最小限の標準インターフェース。投票 UI や DAO が、準拠するどの投票コントラクトとも連携できるようにする。","ko":"제안 ID에 온체인 투표를 하기 위한 최소한의 표준 인터페이스. 투표 UI와 DAO가 규격을 따르는 어떤 투표 컨트랙트와도 함께 동작할 수 있게 한다.","zh":"用于对某个提案 ID 进行链上投票的最简标准接口，让投票界面和 DAO 可以与任何兼容的投票合约协作。"},"tags":["governance","voting","dao","interface"],"explainers":{"en":{"lang":"en","tldr":"A minimal standard interface for casting on-chain votes on a proposal ID, so voting UIs and DAOs can work with any compliant voting contract.","tags":["governance","voting","dao","interface"],"related":[5269,5247,5453,20,721],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-1202/","markdown":"## What problem does it solve?\n\nVoting is one of the oldest things people built with smart contracts, and every DAO needs it. But each voting contract exposes its own functions and events, so a general voting UI, an indexer or another contract that wants to \"vote automatically\" has to be written for each one separately.\n\nERC-1202 defines a small common surface: cast a vote on a proposal, record it with a standard event, and execute the result. Anything built on that surface can talk to any compliant contract.\n\n## How it works\n\nThe spec deliberately keeps a lot **out of scope**: delegation, how voting weight or eligibility is calculated (snapshots, quadratic voting…), what a proposal contains, and off-chain signature aggregation. Proposals are just a `uint256 proposalId`. Related ideas are left to separate proposals such as [ERC-5247](/eip-5247/) (executable proposals) and [ERC-5453](/eip-5453/) (endorsements).\n\nWhat it does require:\n\n- **`IERC1202Core`** (mandatory): `castVote`, `castVoteFrom` (vote on behalf of another address), `execute`, and the `VoteCast` event. A vote carries `support` (a `uint8` option, chosen for compatibility with GovernorBravo), a `weight`, a `reasonUri` and free-form `extraParams`.\n- **`IERC1202MultiVote`** (optional, required if you support multiple options per voter, e.g. ranked choice): `castMultiVote` with arrays of options and weights.\n- **`IERC1202Info`** (described for reading): the voting period for a proposal and a voter's eligible weight.\n- Compliant contracts SHOULD implement [ERC-5269](/eip-5269/) so callers can discover which interfaces they support.\n\n## Sample code\n\nThe core interface plus a toy one-address-one-vote implementation (illustrative; the spec's listing omits return types, so this sketch returns nothing):\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC1202Core {\n    event VoteCast(address indexed voter, uint256 indexed proposalId,\n        uint8 support, uint256 weight, string reason, bytes extraParams);\n\n    function castVote(uint256 proposalId, uint8 support, uint256 weight,\n        string calldata reasonUri, bytes calldata extraParams) external payable;\n    function castVoteFrom(address from, uint256 proposalId, uint8 support, uint256 weight,\n        string calldata reasonUri, bytes calldata extraParams) external payable;\n    function execute(uint256 proposalId, bytes memory extraParams) external payable;\n}\n\ncontract SimpleVote is IERC1202Core {\n    mapping(uint256 =\u003e mapping(uint8 =\u003e uint256)) public tally;\n    mapping(uint256 =\u003e mapping(address =\u003e bool)) public voted;\n\n    function castVote(uint256 id, uint8 support, uint256, string calldata reason,\n        bytes calldata extra) external payable {\n        require(!voted[id][msg.sender], \"already voted\");\n        voted[id][msg.sender] = true;\n        tally[id][support] += 1;           // weight fixed at 1 here\n        emit VoteCast(msg.sender, id, support, 1, reason, extra);\n    }\n\n    function castVoteFrom(address, uint256, uint8, uint256, string calldata,\n        bytes calldata) external payable { revert(\"not supported\"); }\n\n    function execute(uint256, bytes memory) external payable { /* app-specific */ }\n}\n```\n\n## Things to know\n\n- **Status: Review.** The interface has changed substantially over the years (it dates from 2018), so check the current text before building on it.\n- The standard says nothing about who may vote or how weight is computed; your implementation must define and enforce that, and `weight` passed by the caller should not be trusted blindly.\n- On a public chain votes are visible; the spec notes that real anonymity needs cryptographic techniques beyond this interface.\n- It flags bribery as a risk: once votes are on-chain and standard, another contract can pay people to vote a certain way.\n- Production DAOs commonly use audited governor frameworks; treat this ERC as an interoperability layer, not a complete governance system.\n"},"ja":{"lang":"ja","tldr":"提案 ID に対するオンチェーン投票を行うための最小限の標準インターフェース。投票 UI や DAO が、準拠するどの投票コントラクトとも連携できるようにする。","tags":["governance","voting","dao","interface"],"related":[5269,5247,5453,20,721],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-1202/","markdown":"## 何を解決するのか\n\n投票は、スマートコントラクトで人々が最も早くから作ってきたものの 1 つで、あらゆる DAO が必要とします。しかし投票コントラクトごとに関数もイベントも異なるため、汎用の投票 UI、インデクサー、あるいは「自動で投票したい」別のコントラクトは、それぞれ個別に書かなければなりません。\n\nERC-1202 は小さな共通の面を定義します。提案に投票し、標準イベントで記録し、結果を実行する、というものです。この面の上に作られたものは、準拠するどのコントラクトとも通信できます。\n\n## 仕組み\n\n仕様は意図的に多くを**スコープ外**としています。委任、投票の重みや資格の計算方法（スナップショット、二次投票など）、提案の内容、オフチェーン署名の集約です。提案は単なる `uint256 proposalId` です。関連するアイデアは、[ERC-5247](/eip-5247/)（実行可能な提案）や [ERC-5453](/eip-5453/)（エンドースメント）などの別の提案に委ねられています。\n\n必須とされるのは次のものです。\n\n- **`IERC1202Core`**（必須）: `castVote`、`castVoteFrom`（他のアドレスに代わって投票）、`execute`、および `VoteCast` イベント。投票は、`support`（GovernorBravo との互換性のために選ばれた `uint8` の選択肢）、`weight`、`reasonUri`、自由形式の `extraParams` を持ちます。\n- **`IERC1202MultiVote`**（任意。投票者ごとに複数の選択肢、たとえば順位付き投票をサポートする場合は必須）: 選択肢と重みの配列を取る `castMultiVote`。\n- **`IERC1202Info`**（読み取り用として記述）: 提案の投票期間と、投票者の有資格の重み。\n- 準拠するコントラクトは、呼び出し側がサポートされているインターフェースを発見できるよう、[ERC-5269](/eip-5269/) を実装すべきです（SHOULD）。\n\n## サンプルコード\n\nコアインターフェースと、1 アドレス 1 票のおもちゃの実装です（説明用。仕様のリストは戻り値の型を省略しているため、このスケッチは何も返しません）。\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC1202Core {\n    event VoteCast(address indexed voter, uint256 indexed proposalId,\n        uint8 support, uint256 weight, string reason, bytes extraParams);\n\n    function castVote(uint256 proposalId, uint8 support, uint256 weight,\n        string calldata reasonUri, bytes calldata extraParams) external payable;\n    function castVoteFrom(address from, uint256 proposalId, uint8 support, uint256 weight,\n        string calldata reasonUri, bytes calldata extraParams) external payable;\n    function execute(uint256 proposalId, bytes memory extraParams) external payable;\n}\n\ncontract SimpleVote is IERC1202Core {\n    mapping(uint256 =\u003e mapping(uint8 =\u003e uint256)) public tally;\n    mapping(uint256 =\u003e mapping(address =\u003e bool)) public voted;\n\n    function castVote(uint256 id, uint8 support, uint256, string calldata reason,\n        bytes calldata extra) external payable {\n        require(!voted[id][msg.sender], \"already voted\");\n        voted[id][msg.sender] = true;\n        tally[id][support] += 1;           // weight fixed at 1 here\n        emit VoteCast(msg.sender, id, support, 1, reason, extra);\n    }\n\n    function castVoteFrom(address, uint256, uint8, uint256, string calldata,\n        bytes calldata) external payable { revert(\"not supported\"); }\n\n    function execute(uint256, bytes memory) external payable { /* app-specific */ }\n}\n```\n\n## 知っておくべきこと\n\n- **ステータス: Review。** このインターフェースは長年（2018 年に遡ります）で大きく変化しているため、利用する前に最新のテキストを確認してください。\n- この標準は、誰が投票できるか、重みをどう計算するかについて何も定めていません。実装側でそれを定義して強制する必要があり、呼び出し元が渡す `weight` を無条件に信用してはいけません。\n- 公開チェーンでは投票は見えます。仕様は、本当の匿名性にはこのインターフェースを超える暗号技術が必要だと述べています。\n- 買収（賄賂）をリスクとして挙げています。投票がオンチェーンで標準化されると、別のコントラクトが特定の投票をするよう人々に報酬を支払えるようになります。\n- 本番の DAO では、監査済みのガバナーフレームワークが一般的に使われます。この ERC は完全なガバナンスシステムではなく、相互運用のための層として扱ってください。\n"},"ko":{"lang":"ko","tldr":"제안 ID에 온체인 투표를 하기 위한 최소한의 표준 인터페이스. 투표 UI와 DAO가 규격을 따르는 어떤 투표 컨트랙트와도 함께 동작할 수 있게 한다.","tags":["governance","voting","dao","interface"],"related":[5269,5247,5453,20,721],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-1202/","markdown":"## 어떤 문제를 해결하나요?\n\n투표는 사람들이 스마트 컨트랙트로 가장 일찍 만든 것 중 하나이며 모든 DAO에 필요합니다. 하지만 투표 컨트랙트마다 함수와 이벤트가 다르기 때문에, 범용 투표 UI, 인덱서, 혹은 \"자동으로 투표\"하려는 다른 컨트랙트는 각각 따로 작성해야 합니다.\n\nERC-1202는 작은 공통 표면을 정의합니다. 제안에 투표하고, 표준 이벤트로 기록하고, 결과를 실행하는 것입니다. 이 표면 위에 만들어진 것은 규격을 따르는 어떤 컨트랙트와도 대화할 수 있습니다.\n\n## 어떻게 동작하나요?\n\n명세는 많은 부분을 의도적으로 **범위 밖**에 둡니다. 위임, 투표 가중치나 자격의 계산 방식(스냅샷, 이차 투표 등), 제안에 담기는 내용, 오프체인 서명 집계입니다. 제안은 단순한 `uint256 proposalId`입니다. 관련 아이디어는 [ERC-5247](/eip-5247/)(실행 가능한 제안)과 [ERC-5453](/eip-5453/)(보증) 같은 별도 제안에 맡깁니다.\n\n요구하는 것은 다음과 같습니다.\n\n- **`IERC1202Core`**(필수): `castVote`, `castVoteFrom`(다른 주소를 대신해 투표), `execute`, 그리고 `VoteCast` 이벤트. 투표는 `support`(GovernorBravo와의 호환을 위해 고른 `uint8` 선택지), `weight`, `reasonUri`, 자유 형식의 `extraParams`를 담습니다.\n- **`IERC1202MultiVote`**(선택. 투표자당 여러 선택지, 예를 들어 순위 선택 투표를 지원한다면 필수): 선택지와 가중치 배열을 받는 `castMultiVote`.\n- **`IERC1202Info`**(읽기용으로 기술): 제안의 투표 기간과 투표자의 유효 가중치.\n- 규격을 따르는 컨트랙트는 호출자가 지원하는 인터페이스를 발견할 수 있도록 [ERC-5269](/eip-5269/)를 구현해야 합니다(SHOULD).\n\n## 샘플 코드\n\n핵심 인터페이스와 장난감 수준의 한 주소 한 표 구현입니다(설명용. 명세의 목록은 반환 타입을 생략하므로 이 스케치는 아무것도 반환하지 않습니다).\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC1202Core {\n    event VoteCast(address indexed voter, uint256 indexed proposalId,\n        uint8 support, uint256 weight, string reason, bytes extraParams);\n\n    function castVote(uint256 proposalId, uint8 support, uint256 weight,\n        string calldata reasonUri, bytes calldata extraParams) external payable;\n    function castVoteFrom(address from, uint256 proposalId, uint8 support, uint256 weight,\n        string calldata reasonUri, bytes calldata extraParams) external payable;\n    function execute(uint256 proposalId, bytes memory extraParams) external payable;\n}\n\ncontract SimpleVote is IERC1202Core {\n    mapping(uint256 =\u003e mapping(uint8 =\u003e uint256)) public tally;\n    mapping(uint256 =\u003e mapping(address =\u003e bool)) public voted;\n\n    function castVote(uint256 id, uint8 support, uint256, string calldata reason,\n        bytes calldata extra) external payable {\n        require(!voted[id][msg.sender], \"already voted\");\n        voted[id][msg.sender] = true;\n        tally[id][support] += 1;           // weight fixed at 1 here\n        emit VoteCast(msg.sender, id, support, 1, reason, extra);\n    }\n\n    function castVoteFrom(address, uint256, uint8, uint256, string calldata,\n        bytes calldata) external payable { revert(\"not supported\"); }\n\n    function execute(uint256, bytes memory) external payable { /* app-specific */ }\n}\n```\n\n## 알아둘 점\n\n- **상태: Review.** 이 인터페이스는 수년에 걸쳐(2018년부터) 크게 바뀌었으므로, 기반으로 삼기 전에 현재 텍스트를 확인하세요.\n- 표준은 누가 투표할 수 있는지, 가중치를 어떻게 계산하는지에 대해 아무 말도 하지 않습니다. 구현에서 이를 정의하고 강제해야 하며, 호출자가 전달한 `weight`를 무작정 신뢰해서는 안 됩니다.\n- 공개 체인에서는 투표가 보입니다. 명세는 진정한 익명성에는 이 인터페이스를 넘어서는 암호 기술이 필요하다고 밝힙니다.\n- 매수(뇌물)를 위험으로 지적합니다. 투표가 온체인에 있고 표준화되면 다른 컨트랙트가 사람들에게 특정 방향으로 투표하도록 대가를 지급할 수 있습니다.\n- 실서비스 DAO는 보통 감사를 받은 거버너 프레임워크를 사용합니다. 이 ERC는 완전한 거버넌스 시스템이 아니라 상호 운용성 계층으로 보세요.\n"},"zh":{"lang":"zh","tldr":"用于对某个提案 ID 进行链上投票的最简标准接口，让投票界面和 DAO 可以与任何兼容的投票合约协作。","tags":["governance","voting","dao","interface"],"related":[5269,5247,5453,20,721],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-1202/","markdown":"## 它解决什么问题？\n\n投票是人们最早用智能合约构建的东西之一，每个 DAO 都需要它。但每个投票合约都暴露自己的函数和事件，所以通用的投票界面、索引器，或想“自动投票”的其他合约，都必须为每一个合约单独编写。\n\nERC-1202 定义了一个小型的公共接口面：对提案投票，用标准事件记录，并执行结果。凡是建立在这个接口面上的东西，都能与任何兼容的合约对话。\n\n## 它如何运作\n\n规范有意把很多内容划在**范围之外**：委托、投票权重或资格的计算方式（快照、二次方投票等）、提案包含什么，以及链下签名聚合。提案只是一个 `uint256 proposalId`。相关的想法留给单独的提案，例如 [ERC-5247](/eip-5247/)（可执行提案）和 [ERC-5453](/eip-5453/)（背书）。\n\n它确实要求的内容：\n\n- **`IERC1202Core`**（必需）：`castVote`、`castVoteFrom`（代表另一个地址投票）、`execute`，以及 `VoteCast` 事件。一次投票包含 `support`（一个 `uint8` 选项，为兼容 GovernorBravo 而选）、`weight`、`reasonUri` 和自由格式的 `extraParams`。\n- **`IERC1202MultiVote`**（可选；如果支持每位投票者选择多个选项，例如排序选择投票，则必需）：带有选项数组和权重数组的 `castMultiVote`。\n- **`IERC1202Info`**（描述用于读取）：提案的投票期，以及投票者的有效权重。\n- 兼容的合约应当（SHOULD）实现 [ERC-5269](/eip-5269/)，以便调用者发现它们支持哪些接口。\n\n## 示例代码\n\n核心接口，加上一个“一个地址一票”的玩具实现（仅作示意；规范中的清单省略了返回类型，所以这个草图不返回任何值）：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC1202Core {\n    event VoteCast(address indexed voter, uint256 indexed proposalId,\n        uint8 support, uint256 weight, string reason, bytes extraParams);\n\n    function castVote(uint256 proposalId, uint8 support, uint256 weight,\n        string calldata reasonUri, bytes calldata extraParams) external payable;\n    function castVoteFrom(address from, uint256 proposalId, uint8 support, uint256 weight,\n        string calldata reasonUri, bytes calldata extraParams) external payable;\n    function execute(uint256 proposalId, bytes memory extraParams) external payable;\n}\n\ncontract SimpleVote is IERC1202Core {\n    mapping(uint256 =\u003e mapping(uint8 =\u003e uint256)) public tally;\n    mapping(uint256 =\u003e mapping(address =\u003e bool)) public voted;\n\n    function castVote(uint256 id, uint8 support, uint256, string calldata reason,\n        bytes calldata extra) external payable {\n        require(!voted[id][msg.sender], \"already voted\");\n        voted[id][msg.sender] = true;\n        tally[id][support] += 1;           // weight fixed at 1 here\n        emit VoteCast(msg.sender, id, support, 1, reason, extra);\n    }\n\n    function castVoteFrom(address, uint256, uint8, uint256, string calldata,\n        bytes calldata) external payable { revert(\"not supported\"); }\n\n    function execute(uint256, bytes memory) external payable { /* app-specific */ }\n}\n```\n\n## 需要注意\n\n- **状态：Review。** 该接口多年来（始于 2018 年）变化很大，在基于它构建之前请先查看当前文本。\n- 该标准没有规定谁可以投票，或权重如何计算；你的实现必须自行定义并强制执行，而且调用者传入的 `weight` 不应被盲目信任。\n- 在公有链上投票是可见的；规范指出，真正的匿名需要超出此接口的密码学技术。\n- 它把贿选标为一项风险：一旦投票上链并且标准化，其他合约就可以出钱让人们按某种方式投票。\n- 生产环境的 DAO 通常使用经过审计的治理框架；请把这个 ERC 当作互操作层，而不是完整的治理系统。\n"}}}
