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.
ERC-5805 standardizes voting delegation and historical voting-power queries for tokens used in on-chain governance, including DAOs.
This article translates, summarizes, and expands on the following proposal.
More EIP explainers:
Overview
ERC-5805 defines interfaces for two capabilities commonly needed by DAO governance tokens: delegation, which assigns voting power to another address without transferring token ownership, and checkpoints, which allow historical voting power to be retrieved.
The interface can be applied to different kinds of tokens, including ERC-20 and ERC-721. It supports clocks based on block numbers, block timestamps, or other monotonically increasing functions. This gives governance systems flexibility when operating on networks with different or irregular block intervals, although it does not by itself synchronize governance across chains.
Motivation
The balanceOf(address) function provided by existing token standards is not sufficient for governance.
- If voting uses only the current balance, a user may vote, transfer the tokens, and have the same tokens counted again.
- Token holders cannot delegate voting power independently of ownership through the balance interface alone.
Governance tokens have therefore introduced two mechanisms:
- Delegation separates voting power from token ownership by letting holders select a delegate.
- Checkpoints record changes in voting power so that historical values can be queried.
These mechanisms have not always used a common interface. Moreover, block-number-based tracking may be unsuitable for networks with irregular block intervals.
ERC-5805 provides a shared foundation for interoperable tokens and governance contracts.
Specification
ERC-5805 incorporates the following concepts:
- An account can delegate its voting units to itself or another account through
delegate. - Voting units delegated to an account contribute to its voting power.
- Historical voting power is available through checkpoints and
getPastVotes. - History can be indexed by
block.number,block.timestamp, or another monotonically increasing clock. - ERC-6372 enables the contract to expose the clock mechanism it uses.
- Voting units delegated to
address(0)do not count toward active voting power.
For ERC-6372, see the following article.
ERC-6372: Identifying the timekeeping mechanism used by a contract
Functions
getVotes
function getVotes(address account) external view returns (uint256);Returns an account's current voting power, including the voting units delegated to that account. Calling this function for address(0) must return 0.
Parameter
account- The account whose voting power is requested.
Return value
votingWeight- The total current voting power delegated to the account.
getPastVotes
function getPastVotes(address account, uint256 timepoint) external view returns (uint256);Returns the voting power delegated to an account at a specified historical timepoint, such as a block number. The timepoint must be in the past; implementations reject queries at or beyond the current clock value.
Parameters
account- The account being queried.
timepoint- The historical block number, timestamp, or other clock value.
Return value
votingWeight- The voting power delegated to the account at that timepoint.
delegates
function delegates(address account) external view returns (address);Returns the address to which an account currently delegates its voting units. If it returns address(0), those units are not counted as active voting power.
Parameter
account- The delegating account.
Return value
delegatee- The current delegate's address.
delegate
function delegate(address delegatee) external;Delegates the caller's voting units to the specified account. Changes to the delegation relationship and voting power are reflected through the DelegateChanged and DelegateVotesChanged events as applicable.
Parameter
delegatee- The new delegate.
delegateBySig
function delegateBySig(
address delegatee,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) external;Sets delegation on-chain using an off-chain signature. The nonce prevents signature replay, and the expiry limits the period during which the signature can be submitted.
Parameters
delegatee- The delegate's address.
nonce- The signer's current nonce.
expiry- The expiration timestamp.
v,r,s- The components of the EIP-712 signature.
For EIP-712, see the following article.
EIP-712: Hashing and signing typed structured data
nonces
function nonces(address owner) public view virtual returns (uint256);Returns an account's current nonce, used to prevent replay of signatures submitted through delegateBySig. The counter increments when a valid nonce is consumed.
Parameter
owner- The account whose nonce is requested.
Return value
nonce- The current nonce.
Events
DelegateChanged
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);Emitted when an account changes its delegate through delegate or delegateBySig.
Parameters
delegator- The account assigning its voting units.
fromDelegate- The previous delegate.
toDelegate- The new delegate.
DelegateVotesChanged
event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);Emitted when a delegate's voting power changes. This can occur when a holder changes delegates or when voting units are transferred between accounts with different delegates.
Parameters
delegate- The delegate whose voting power changes.
previousBalance- Voting power before the change.
newBalance- Voting power after the change.
Additional considerations
Delegation lets token holders assign voting power to a trusted representative without transferring their tokens. It can reduce the number of accounts that need to submit individual voting transactions and enable smaller holders to participate through a representative. Holders can change their delegation at any time, including delegating to themselves.
Checkpoints help prevent transferred tokens from being counted twice. A governance contract can determine voting eligibility and weight using the delegation state at a predefined snapshot. Transfers made after that snapshot do not change the voting weight for that proposal. The governance contract must also prevent an eligible account from voting more than once under its applicable voting rules.
Users therefore need to acquire voting units and delegate them before the relevant snapshot, subject to the governor's rules. Many governors provide a delay between proposal creation and the snapshot so that participants can prepare their voting power.
ERC-6372 exposes the clock value through clock() as a uint48. The getPastVotes parameter remains a uint256 for compatibility. A timepoint outside the clock's representable range cannot be a valid historical timepoint and should be rejected.
delegateBySig supports off-chain signing and submission by a third party. The signer does not have to pay the submission gas when a relayer pays it instead. Nonces prevent replay, and the signature uses the widely supported EIP-712 typed-data format.
Compatibility
Compound and OpenZeppelin already had governance-token implementations with delegation when this proposal was written. ERC-5805 shares their delegation methods and adopts a uint256 return value for historical voting power, consistent with OpenZeppelin's approach.
The implementations discussed in the proposal used block-number checkpoints without ERC-6372. ERC-5805 accommodates this legacy block-number mode. Modern OpenZeppelin versions also support ERC-6372 clocks, so compatibility between a governor and a token should be assessed using the particular versions and clock modes involved.
Security
Several considerations apply when retrieving and delegating voting power.
Timepoint handling
Clients and governance contracts must interpret query parameters using the clock mode exposed by the token.
- Querying a timestamp-based token using a block number may return zero or an unintended historical value.
- Querying a block-number-based token using a Unix timestamp may revert because that timepoint lies in the future.
Front-running delegateBySig
Anyone who obtains a valid delegation signature may submit it before the intended relayer. The resulting delegation is still the one authorized by the signer, but the original submission may fail because its nonce has already been consumed.
Rejecting an invalid recovered signer
The ecrecover precompile can return address(0) for an invalid signature rather than reverting. Implementations of delegateBySig must therefore check that the recovered signer is not the zero address.
This check concerns the signer, not the delegatee. Delegating to the zero address is an intentional way to deactivate voting power, and a holder can subsequently delegate those units again.
Censorship of signed delegations
A relayer may refuse to submit a delegation signature on-chain. Potential mitigations include:
- Setting an
expirythat limits the signature's validity. - Allowing the signer to submit
delegateBySigdirectly if they have ETH to pay for gas.
Chain forks and DOMAIN_SEPARATOR
If a DOMAIN_SEPARATOR containing the chain ID is cached permanently without checking whether the chain ID has changed, a signature may become replayable across chains after a fork.
Implementations should recompute the separator when the relevant domain parameters change, or use a compatible EIP-712 implementation that correctly handles such changes.
Citation
Hadrien Croubois (@Amxx), Francisco Giordano (@frangio), "ERC-5805: Voting with delegation [DRAFT]," Ethereum Improvement Proposals, no. 5805, July 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-5805.
Conclusion
ERC-5805 standardizes delegation and historical voting power for governance tokens, allowing token ownership, active voting power, and historical governance snapshots to be handled separately.
Questions are welcome via Twitter @cardene777.
Other publications:



