Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines ERC1202, a proposal defining a standard interface for on-chain voting.
This article translates, summarizes, and expands on the proposal linked below.
As of October 10, 2023, ERC1202 was at the Draft stage.
Overview
This EIP defines an API for implementing voting through smart contracts. The standard provides functionality for casting votes, displaying voting results, and setting voting status.
Motivation
Voting has been a concept in EVM (Ethereum Virtual Machine) programming since its early days. It plays an important role in DAOs (decentralized autonomous organizations) and organizational governance. Many DAOs are expected to adopt voting as part of their governance in the future.
Establishing a voting standard for smart contracts and tokens offers several benefits.
Benefits of a standard
- Common UIs and applications
- A standardized voting protocol makes it easier for ordinary users to participate and for developers to build common user interfaces and applications.
- Lower barriers to participation encourage governance in decentralized applications (DApps) and DAOs.
- Delegated, smart contract, and automated voting
- Standardized voting protocols enable advanced voting methods, including delegation and automated votes through smart contracts.
- These can make voting processes more efficient and reliable.
- Recording voting results on-chain
- Voting results can be recorded on the blockchain in a standard format.
- DAOs and DApps can then programmatically honor the results.
- Compatibility with token standards
- Standardized voting protocols can more readily integrate with token standards such as ERC20 and ERC721.
- Easier token integration opens up a wider range of applications.
- Ecosystem interoperability
- Standardization improves interoperability within the Ethereum ecosystem and with other systems.
- It facilitates data sharing and coordination across platforms.
- Customizable voting
- A voting protocol can be customized to set voting deadlines and allow one or multiple choices.
- This flexibility comes at the cost of increased interface complexity.
- Recording weighted votes
- Voting results can incorporate weights based on token quantities.
- This allows the influence of token holders to be adjusted.
- Privacy-preserving and anonymous voting
- Randomized or obfuscated voting options that do not associate a voter's address with their choice may enable privacy-preserving or anonymous voting.
- Incentives through rewards
- Rewards for participating in a vote or based on its outcome may encourage user engagement.
Standardizing voting may help decentralized organizations and projects govern more effectively and provide benefits to their users.
Non-goals and out-of-scope functionality
The following areas are outside the scope of this proposal.
- Vote delegation
- The proposal deliberately excludes delegated voting.
- A separate EIP may address specific delegation use cases.
- Eligibility and voting weight
- Some implementers want to make voting weight and eligibility configurable.
- For example, OpenZeppelin's GovernorBravo implementation uses snapshots.
- Weight calculations such as those used in quadratic voting are also outside this EIP's scope.
- The proposal is intended to accommodate both existing and new approaches to calculating voting power.
- Proposals
- Proposals themselves are deliberately outside the scope.
- A proposal is identified by
proposalId, but its details, whether it exists on-chain or off-chain, and whether it is executable are not specified. - A separate EIP may address specific proposal-related use cases.
- ERC5247 is an example of a related proposal.
- Signature aggregation and approvals
- An implementation may want users to submit votes or approvals offline and allow another account to create the transaction. Signature aggregation and approvals for this purpose are outside the proposal's scope.
- A separate EIP may address this particular use case.
- ERC5453 is an example of a related proposal.
These items are outside the scope of this EIP. Separate EIPs can address their specific use cases.
Use cases
The original article also describes a simple machine-readable binary format for signaling to wallets that a user action is required.
It describes a format extensible by future ERCs that accepts arbitrary parameters containing up to 64kB of data.
Examples include prompting a user to approve tokens on an exchange, send an HTTP request, or change a key after a specified period.
The described format is intended to support future extensions and provide a foundation for wallets and smart contracts to handle user actions.
Voting is one of the earliest examples of programming on Ethereum's virtual machine, the EVM, and is a key component of governance processes in DAOs and other organizations. Many DAOs will need to use voting as part of their governance. A voting standard for smart contracts and tokens therefore offers substantial benefits.
Standardization offers the following advantages.
- Consistency and predictability
- A voting standard makes voting processes consistent and predictable across projects and DAOs.
- This improves transparency and reliability, giving participants greater confidence.
- Smart contract integration
- A voting standard can be integrated into smart contracts to provide a smooth voting process.
- Voting through smart contracts can reduce misconduct and misunderstandings and improve reliability.
- Efficient governance
- A voting standard can make governance processes in DAOs and organizations more efficient.
- Decisions can be made more efficiently and the decision-making process can be accelerated.
- Extensibility
- A voting standard is designed to accommodate future needs and can adapt as new features and requirements arise.
Establishing a voting standard is an important step toward more efficient and transparent governance in decentralized organizations and projects.
Specification
Contracts conforming to this proposal must implement the following IERC1202Core interface.
interface IERC1202Core {
event VoteCast(
address indexed voter,
uint256 indexed proposalId,
uint8 support,
uint256 weight,
string reason,
bytes extraParams
);
function castVote(
uint256 proposalId,
uint8 support,
uint256 weight,
string calldata reasonUri,
bytes calldata extraParams
) external payable returns;
function castVoteFrom(
address from,
uint256 proposalId,
uint8 support,
uint256 weight,
string calldata reasonUri,
bytes calldata extraParams
) external payable returns;
function execute(uint256 proposalId, bytes memory extraParams) payable external;
}VoteCast
event VoteCast(
address indexed voter,
uint256 indexed proposalId,
uint8 support,
uint256 weight,
string reason,
bytes extraParams
);Overview
An event emitted when a vote is cast, recording the details of the vote.
Details
Voting information is recorded in transaction logs and made public on the blockchain. This provides transparency and traceability. The parameters are described below.
Parameters
voter- Address of the user who cast the vote.
- Indexed so votes associated with this address can be identified.
proposalId- Unique identifier of the proposal being voted on.
- Indexed so the proposal can be identified.
support- Numeric value representing support for or opposition to the proposal.
- Typically,
1indicates support and0indicates opposition.
weight- The voting weight.
- Represents the voter's influence.
reason- Text containing the reason for the vote or a comment.
- Provides an explanation of the reasoning behind the vote.
extraParams- Byte array containing additional parameters or data.
- May include custom data as needed.
castVote
function castVote(
uint256 proposalId,
uint8 support,
uint256 weight,
string calldata reasonUri,
bytes calldata extraParams
) external payable returns;Overview
Casts a vote. The function casts a vote on a proposal and records the result.
Details
Casts a vote on the specified proposal.
The support parameter specifies support or opposition, and weight specifies the voting weight.
The reasonUri parameter specifies the URI of the reason for the vote, while extraParams can carry additional parameters.
Because the function is declared payable, it can also receive Ether when a vote is successfully cast.
Parameters
proposalId- Integer identifying the proposal being voted on.
support- Integer indicating support (
1) or opposition (0).
- Integer indicating support (
weight- Integer representing the voting weight.
reasonUri- String representing the URI of the reason for the vote.
extraParams- Byte sequence containing additional parameters.
castVoteFrom
function castVoteFrom(
address from,
uint256 proposalId,
uint8 support,
uint256 weight,
string calldata reasonUri,
bytes calldata extraParams
) external payable returns;Overview
Casts a vote on behalf of another address. The function casts a vote from the specified address and records the result.
Details
Casts a vote on behalf of the specified from address.
As with castVote, the remaining parameters specify support, weight, the reason for the vote, and additional data.
The function can also receive Ether.
Parameters
from- Address on whose behalf the vote is cast.
proposalId- Integer identifying the proposal being voted on.
support- Integer indicating support (
1) or opposition (0).
- Integer indicating support (
weight- Integer representing the voting weight.
reasonUri- String representing the URI of the reason for the vote.
extraParams- Byte sequence containing additional parameters.
execute
function execute(uint256 proposalId, bytes memory extraParams) payable external;Overview
Executes a proposal. The function triggers proposal execution and retrieves the execution result.
Details
Executes the specified proposal.
The proposal ID is supplied through proposalId, and any additional parameters needed for execution are supplied through extraParams.
The function can also receive Ether.
Parameters
proposalId- Integer identifying the proposal to execute.
extraParams- Byte sequence containing additional parameters required for execution.
A contract conforming to this proposal may implement the IERC1202MultiVote Interface. If the contract is intended to support multiple choices, such as ranked-choice voting or variable-weight voting, it must implement the IERC1202MultiVote Interface.
interface IERC1202MultiVote {
event MultiVoteCast(
address indexed voter,
uint256 indexed proposalId,
uint8[] support,
uint256[] weight,
string reason,
bytes extraParams
);
function castMultiVote(
uint256 proposalId,
uint8[] support,
uint256[] weight,
string calldata reasonUri,
bytes calldata extraParams
) external payable;
}MultiVoteCast
event MultiVoteCast(
address indexed voter,
uint256 indexed proposalId,
uint8[] support,
uint256[] weight,
string reason,
bytes extraParams
);Overview
An event emitted when multiple votes are cast together.
Details
Records voting information for monitoring transactions and tracking data.
Parameters
voter- Address of the voter.
proposalId- ID of the proposal being voted on.
support- Array of integers indicating support (
1) or opposition (0).
- Array of integers indicating support (
weight- Array of integers representing voting weights.
reason- String describing the reason for the vote.
extraParams- Byte sequence containing additional parameters.
castMultiVote
function castMultiVote(
uint256 proposalId,
uint8[] support,
uint256[] weight,
string calldata reasonUri,
bytes calldata extraParams
) external payable;Overview
Casts multiple votes together. Multiple pieces of voting information are submitted in a single call, and the result of each vote is recorded.
Details
The function accepts multiple votes in a single submission.
Corresponding array elements describe the same vote, allowing multiple votes to be processed together.
The function is declared payable, so it can also receive Ether.
Parameters
proposalId- Integer identifying the proposal being voted on.
support- Array of integers indicating support (
1) or opposition (0) for each vote.
- Array of integers indicating support (
weight- Array of integers representing the weight of each vote.
reasonUri- String representing the URI of the reason for the vote.
extraParams- Byte sequence containing additional parameters.
Retrieving voting periods, eligibility, and voting weights
interface IERC1202Info {
function votingPeriodFor(uint256 proposalId) external view returns (uint256 startPointOfTime, uint256 endPointOfTime);
function eligibleVotingWeight(uint256 proposalId, address voter) external view returns (uint256);
}votingPeriodFor
function votingPeriodFor(uint256 proposalId) external view returns (uint256 startPointOfTime, uint256 endPointOfTime);Overview
Retrieves the beginning and end of the voting period for a specified proposal.
Details
Retrieves information about the voting period associated with the specified proposalId.
Specifically, it returns timestamps for the beginning and end of the voting period.
This allows callers to determine the timeframe during which voting takes place.
Parameters
proposalId- Integer identifying the proposal whose voting period is requested.
Return values
The function returns two integers:
startPointOfTime- Timestamp representing the beginning of the voting period.
endPointOfTime- Timestamp representing the end of the voting period.
eligibleVotingWeight
function eligibleVotingWeight(uint256 proposalId, address voter) external view returns (uint256);Overview
Retrieves the voting weight of a particular voter for a specified proposal.
Details
Retrieves the voting weight of a particular voter for the specified proposalId.
Voting weight depends on the proposal and the voter and may differ from one proposal to another.
This information helps determine how much influence the voter has.
Parameters
proposalId- Integer identifying the proposal for which voting weight is requested.
voter- Address of the voter whose voting weight is requested.
Return value
uint256- Integer representing the specified voter's voting weight for the specified proposal.
Additional considerations
The following sections describe design decisions and their rationale.
Granularity and anonymity
The proposal introduces a primarily read-only function called ballotOf to make it easy to inspect votes cast from a particular address.
The function is based on the following assumptions.
-
Votes from a particular address can be inspected directly. However, if implementers do not want to make such inspection easy, they may simply reject all calls to the function. The proposal aims to support both anonymous and non-anonymous voting. Because every smart contract call is recorded in block history, however, actual confidentiality cannot be achieved without cryptographic techniques. See the related topic Second Feedback Questions 2018 for more on these techniques.
-
Each individual address is assumed to vote for only one choice. However, available voting power can be distributed at a finer granularity. If the implementation permits this, users can be asked to create a new wallet address and grant it specific permissions. For example, in token-based voting where voting power depends on the amount of tokens held, a voter can transfer some tokens to a new account and vote for different options from the two accounts.
This approach allows fine-grained control of votes and can support anonymity. It is important to remember, however, that smart contract calls are public and recorded on the blockchain.
Voting weight
Voting power
The proposal assumes that individual votes may carry different weights, or degrees of influence. Different voters can therefore have different levels of influence over the same proposal. Weight can be calculated using factors such as the amount of tokens a voter holds and indicates how much influence that person's vote has over the proposal.
Configuring weights
The weight is configured by the implementer (contract developer) or specified when the contract is created. Voting weight is determined according to rules defined within the contract. It is often calculated from token holdings but may also be based on other factors.
Checking voting weight
Voters can check their voting weight by calling functions such as eligibleVotingWeight with their address (voter) and a particular proposal (proposalId).
This allows them to understand their weight and see their influence over a proposal in a transparent and fair manner.
The mechanism can make voting more transparent and fair, accommodate differences in voting weight, and improve decision-making processes within projects and organizations.
Backward compatibility
The support option uses uint8 for backward compatibility with GovernorBravo.
The range can be expanded in the future.
Security considerations
Integration with other contracts
The voting standard is expected to be used with other contracts, such as contracts for distributing tokens, executing actions based on consensus, representing entities, or managing multisig wallets. For security, implementations should use standard interfaces when executing downstream actions and receiving upstream inputs (votes). Future auditing tools are also expected to be based on these standard interfaces.
Downstream actions
-
Token distribution After a vote, if a particular proposal is accepted, the corresponding tokens may be distributed. The distribution is an action that delivers tokens based on the result of the vote. For example, token holders may vote to determine project funding, and tokens may be distributed according to the result.
-
Multisig wallet operations A multisig wallet may be used to execute a particular action following a vote. If the vote succeeds, the multisig wallet owners can execute that action. For example, signatures required to transfer project funds from a multisig wallet may be supplied based on the vote.
Upstream actions
-
Voting Voting is an upstream action. Community or DAO members cast votes on a particular proposal. Voting is an important upstream action because it affects the policies and decisions of a project or organization.
-
Creating proposals Creating proposals is also an upstream action. Someone may create a proposal and invite community or DAO members to vote on it. Proposals are upstream actions for introducing new actions or changing the direction of a project.
Downstream actions are performed based on voting results and include token distribution and wallet operations. Upstream actions, by contrast, are part of the decision-making process and include voting and creating proposals. A voting protocol connects these actions to support transparent and secure decision-making.
Flexibility and extensibility
This EIP is deliberately kept basic and is expected to be extensible to support different implementations. These implementations may make different assumptions about how actions behave or are interpreted. Many extensions to this EIP are expected to provide more flexible voting. Extensions and implementations should be thoroughly audited before being incorporated into large-scale applications or systems handling substantial asset volumes.
Non-triviality
Some voting applications require anonymity, randomness, time-based deadlines, or ordering. These requirements are known to be difficult to implement. Implementations requiring these features should rely on audited, well-tested shared libraries.
Non-triviality
Non-triviality is a concept used to assess whether a problem or requirement is straightforward or difficult to solve. A trivial problem or requirement is generally easy to understand and solve, whereas a non-trivial one is difficult or complex.
The concept is particularly common in computer science and mathematics. Trivial problems are expected to be easy to compute, while non-trivial problems may be complex and difficult to solve efficiently.
For example, calculating 1 + 1 is a trivial problem that is easily solved.
Non-trivial problems include factoring large numbers and solving NP-complete problems, for which no polynomial-time algorithms are known.
Efficient solutions to these problems have not yet been found, or solving them may require exponential time.
Assessing triviality helps identify the difficulty and requirements of a problem and select an appropriate solution. Non-trivial problems may require new approaches or algorithms and substantial research and effort.
Potential abuse
Once voting is standardized and incorporated into contracts, it becomes possible to create contracts that reward voters for voting in particular ways. This opens up opportunities for bribery and conflicts of interest, potentially creating problems that were previously difficult to exploit.
Standardizing and using voting protocols therefore raises security considerations that require appropriate safeguards.
References
Zainan Victor Zhou (@xinbenlv), Evan (@evbots), Yin Xu (@yingogobot), "ERC-1202: Voting Interface [DRAFT]," Ethereum Improvement Proposals, no. 1202, July 2018. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-1202.
Conclusion
This article examined ERC1202, a proposal for a standard on-chain voting interface.
If you have questions, feel free to contact me via direct message on Twitter.
I also publish articles on other platforms:


