🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
NEWSLIVESearch All Content
đŸ’ŧ Servicesâ„šī¸ Aboutâœ‰ī¸ ContactView Pricing Plansfrom $10

DAOs Explained: Governance Tokens and Voting Design

DAOsđŸŸĸ Free Lesson
DAOs

The one-line mental model

A DAO is a treasury and a set of contracts in which token holders propose changes, vote under a stated rule, and wait out a timelock before anything executes — which makes governance an auditable state machine rather than a meeting.

Prerequisites

  • !ERC-20 tokens and how balance snapshots work
  • !Why a timelock exists between approval and execution

What You'll Learn

  • 1Walk a proposal through voting delay, voting period, quorum, and timelock
  • 2Wire an OpenZeppelin Governor to a votes-enabled token
  • 3Compute quadratic voting power and explain its resistance to whale dominance
  • 4Recognize flash-loan governance and low-turnout capture as distinct attack classes

What a DAO is, and what it is not

The formal definition is narrow: a DAO is a contract-controlled entity whose rules cannot be changed except by the rules themselves. In practice the label covers everything from a two-person multisig guarding a shared wallet to a protocol where thousands of token holders argue about fee switches. Both share one property that a company does not — the ability of any observer to verify what was proposed, how each address voted, and whether the executed calldata matched the approved description.

What a DAO is not is automatically efficient or automatically fair. Token-weighted voting concentrates power proportional to capital, which is a design decision rather than a law of nature, and it is the first thing most governance papers try to improve. The interesting engineering question is therefore never whether to have governance, but which rule converts holdings into influence, and which time delays stand between a passing vote and a drained treasury.

The proposal lifecycle, end to end

Every serious governance system runs the same four phases in the same order, and each phase exists to close a specific attack:

PhaseDuration (example)What happensAttack it closes
Voting delay1 daySnapshot the token balances before discussion peaksBuying votes after reading the proposal text
Active voting5 daysFor and against votes recorded, no executionSurprise execution before holders notice
Timelock queue2 daysPassed proposal waits, publicly visibleInstant rug by a majority coalition
ExecutionAnytime after delayCalldata runs against target contracts— ; paired with the delay it makes exits possible

The voting delay matters more than it appears. Because voting power is measured at a block chosen at proposal creation, an attacker who acquires tokens after the proposal is posted gains no influence over it. The timelock matters just as much for the opposite reason: it gives dissenters time to exit, to rally a counter-proposal, or to coordinate a veto before value actually moves.

Wiring a Governor in OpenZeppelin

The reference implementation packages those phases into composable modules. The token must expose a vote snapshot, and the Governor consumes it:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import "@openzeppelin/contracts/governance/Governor.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorSettings.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol";
import "@openzeppelin/contracts/governance/TimelockController.sol";

contract CommunityGovernor is
    Governor,
    GovernorSettings,
    GovernorCountingSimple,
    GovernorVotes,
    GovernorVotesQuorumFraction,
    GovernorTimelockControl
{
    constructor(IVotes token, TimelockController timelock)
        Governor("CommunityGovernor")
        GovernorSettings(1, 50400, 0)
        GovernorVotes(token)
        GovernorVotesQuorumFraction(4)
        GovernorTimelockControl(timelock)
    {}

    function quorum(uint256 blockNumber)
        public
        view
        override(Governor, GovernorVotesQuorumFraction)
        returns (uint256)
    {
        return super.quorum(blockNumber);
    }

    function state(uint256 proposalId)
        public
        view
        override(Governor, GovernorTimelockControl)
        returns (ProposalState)
    {
        return super.state(proposalId);
    }

    function _execute(
        uint256 proposalId,
        address[] memory targets,
        uint256[] memory values,
        bytes[] memory calldatas,
        bytes32 descriptionHash
    ) internal override(Governor, GovernorTimelockControl) {
        super._execute(proposalId, targets, values, calldatas, descriptionHash);
    }
}

The constructor arguments encode policy as data: a one-block voting delay, a seven-day voting period measured in blocks, no proposal threshold in the settings (set it once your token distribution is stable), and a quorum of four percent of supply. The timelock contract itself holds administrative rights over the protocols the DAO controls, which means the Governor can only act through it, and the delay applies to every action including emergency patches.

Choosing a voting rule

One-token-one-vote is simple and sybil-proof, and it hands the outcome to whichever address holds the most. Quadratic voting instead charges the square of the number of votes a holder wants to cast, so four votes cost sixteen units of power:

python
def linear_power(tokens, votes_wanted):
    return min(tokens, votes_wanted)


def quadratic_cost(tokens, votes_wanted):
    """Cost in tokens to cast n votes under a QV scheme with identity-per-voter."""
    cost = votes_wanted ** 2
    return cost if cost <= tokens else int(tokens ** 0.5)


def quadratic_max_votes(tokens):
    return int(tokens ** 0.5)


holdings = 10_000
print(linear_power(holdings, 10_000))       # 10,000 votes: whale decides alone
print(quadratic_max_votes(holdings))        # 100 votes: far more voices can compete
RuleSybil resistanceWhale influenceImplementation costBest fit
Token-weightedStrongTotalTrivialEarly stage, low stakes
QuadraticWeak without identityDampenedModerate; needs identity layerCommunity decisions
Conviction votingStrongGradualHigher; continuous tallyingFunding public goods
DelegationStrongIndirectModerate; needs delegation registryTechnical protocols with passive holders
Multi-sigStrong (named parties)Total by designTrivialFoundations and emergency response

Quadratic voting is only as sybil-resistant as its identity layer, which is why most implementations gate it with a proof-of-personhood service or a soulbound credential. Without that, splitting holdings across many wallets is the cheapest way to game the square-root math.

Delegation: making participation affordable

Most token holders will never read a governance forum thread, and a design that assumes otherwise ends up with quorums that only a handful of whales clear. Delegation is the pragmatic answer: a holder transfers voting power to an active participant without giving up the underlying tokens, which means the delegate votes with weight while the holder keeps custody and can re-delegate at any time.

Delegation has three properties worth naming explicitly. It is non-custodial — the delegate cannot transfer or sell the delegated tokens. It is revocable in one transaction, which keeps delegates accountable even without a formal election. And it is usually transitive only one level deep, so a delegate cannot silently re-delegate onward and concentrate power further without being noticed in the registry.

The failure mode is apathy compounding. If most holders delegate to the same three addresses because those addresses run good newsletters, governance has effectively become a representative system with worse accountability than a corporate board, and it inherits the same risks: conflicts of interest, regulatory exposure of the delegates, and quiet concentration. The counterweight is a delegation market in which protocol teams, service providers, and community groups all compete for power, plus transparency tooling that shows who delegated to whom and how each delegate voted on every proposal.

A useful operational check for any DAO you participate in: look at the distribution of delegated power before the voting period begins. If the top three delegates could pass a proposal alone, your quorum and threshold settings are decorative, and the real governance conversation is about who those three are.

How DAOs actually get captured

The history of governance failures is short and repetitive, and each pattern has a signature you can check for in a proposal review:

AttackMechanismDefense
Flash-loan governanceBorrow tokens, vote, repay within one transactionSnapshot voting power at proposal creation, or earlier
Low-turnout takeoverProposal passes with tiny participation far below real supportQuorum plus a high enough threshold that apathy is expensive
Vote buyingOff-chain payment for on-chain votesTimelock gives time to detect and respond; conviction voting blurs it
Malicious proposalPassed proposal whose calldata drains the treasuryMultisig veto, scope limits on what the Governor may call
Proposal spamCostless proposals bury meaningful onesDeposit requirements and per-address thresholds

The flash-loan pattern is the one that surprises newcomers most, because it needs no stolen keys and leaves no obvious forensic trail. The fix is baked into the lifecycle: measure voting power at a block before the voting period begins, so borrowed tokens that are repaid an hour later never existed as far as the tally is concerned.

💡The timelock is your incident response plan

When a hostile proposal passes onchain, the only lever left is usually exit pressure plus social coordination during the timelock. Keep the delay long enough for that to work: two days is minimal, a week is comfortable, and an emergency multisig with a scope limit is the pragmatic compromise most large DAOs settled on.

Common Mistakes

Measuring voting power at execution time instead of at proposal snapshot

Fix: Rely on the Governor's snapshot block so borrowed or acquired tokens after the proposal cannot flip the result

Setting quorum low enough that a handful of wallets pass anything

Fix: Calibrate quorum against realistic participation, and raise it as circulating supply broadens

Giving the Governor an unlimited admin right over every protocol contract

Fix: Scope permissions per protocol, keep emergency powers in a separate multisig, and document exactly which functions are governable

Publishing a proposal with a vague description and precise calldata

Fix: Require the description to match the calldata, and simulate the execution against a fork before the vote opens

Best Practices

  • Simulate every proposal on a mainnet fork and post the simulation results with the vote
  • Delegate voting power to active, accountable stewards instead of letting it sit idle in wallets
  • Run a separate, smaller security council with a veto that can only delay, not rewrite, a proposal
  • Keep treasury diversification decisions on a slower cadence than operational ones, because both use the same voting machinery

Interview Questions

Q1: Why snapshot voting power at proposal creation rather than counting live balances?

A live balance count lets an attacker borrow a large stake, vote, and repay within one transaction. Snapshotting at a fixed block means the attacker must hold the tokens before the proposal text is even known, which converts the attack into a capital-intensive bet.

Q2: What does a timelock protect against if the vote already passed?

It protects against surprise and against irreversibility. Holders who disagree can exit, exchanges can freeze deposits, and the community can coordinate a veto or a counter-proposal while the calldata sits unexecuted.

Q3: Is quadratic voting sybil-proof?

No. It assumes roughly one identity per voter. Without an identity layer, an attacker splits holdings across many wallets and pays the square-root price per wallet, which is cheaper than voting the same number of tokens from one address.

Key Takeaways

  • Governance is a state machine: delay, vote, queue, execute, with each phase closing a specific attack
  • OpenZeppelin's Governor packages that lifecycle, but quorum, thresholds, and delay are policy you must set deliberately
  • Voting rules trade simplicity against fairness; quadratic and conviction schemes need identity or continuity assumptions to hold
  • Flash-loan governance, low-turnout capture, and malicious calldata are the three failure modes to check in every design
  • The timelock is not ceremony — it is the only window in which an on-chain incident response can still work
CW

ChatWhole Learn Editorial Team

Written by experienced data scientists, software engineers, and educators. All content is reviewed by industry professionals to ensure accuracy and relevance.

Last reviewed: 2026-10-13

—
☆☆☆☆☆
0 ratings

Rate & Feedback

Continue Learning

Suggested next tutorials based on this topic

Need Expert Blockchain Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement