Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Glossary

Governance Subgraph

A Governance Subgraph is a specialized data indexer, typically built on The Graph protocol, that queries blockchain data for governance events, proposals, and votes.
Chainscore © 2026
definition
BLOCKCHAIN DATA INFRASTRUCTURE

What is a Governance Subgraph?

A specialized data indexing service for on-chain governance systems.

A Governance Subgraph is a specialized, open-source data indexing protocol built on The Graph Network that extracts, processes, and queries structured data from a blockchain's governance contracts and events. It transforms raw, low-level transaction data—such as proposal creation, votes, and delegation events—into a queryable GraphQL API, enabling efficient access to governance metrics and historical records. This abstraction is essential for building governance dashboards, analytics platforms, and voter tools without requiring direct, complex interaction with the blockchain.

The core function of a governance subgraph is defined by its manifest file (subgraph.yaml), which maps specific smart contract addresses and event logs to predefined entity types in a schema. For example, entities like Proposal, Vote, Delegate, and TokenHolder are created. As new governance transactions occur, an indexer running the subgraph continuously scans the chain, populates these entities with data, and makes them instantly available via GraphQL queries. This allows applications to request complex data, such as "all active proposals with their current vote tally," in a single query.

Key data points indexed by a typical governance subgraph include proposal metadata (title, description), status (pending, active, executed), voting power snapshots, individual vote choices (for, against, abstain) with rationale, and delegate histories. Prominent examples include subgraphs for Compound Governance, Uniswap Governance, and Aave Governance, which power their respective official interfaces and community analytics sites. These subgraphs serve as the canonical public data layer for transparent and verifiable governance analysis.

For developers, using a governance subgraph dramatically reduces the complexity of front-end development. Instead of writing custom event listeners and managing data aggregation logic, they can query a single endpoint. A common query might fetch a delegate's voting history across all proposals, including their voting power at each point in time. This reliability and speed are why governance subgraphs are considered critical infrastructure for decentralized autonomous organizations (DAOs) and protocol communities.

The creation and maintenance of a governance subgraph involve a collaborative process. While often initially deployed by core development teams, they are typically open-sourced, allowing any indexer on The Graph's decentralized network to host the service. This ensures data availability and redundancy. Curators signal on high-quality subgraphs to guide indexer resources, and delegators stake GRT tokens to support the network's security and incentivize accurate data service.

how-it-works
BLOCKCHAIN DATA INDEXING

How a Governance Subgraph Works

A governance subgraph is a specialized data indexing service that transforms on-chain governance activity into a queryable API, enabling efficient analysis of proposals, votes, and delegate activity.

A governance subgraph is a decentralized application (dApp) built using The Graph Protocol. It operates by listening for specific events emitted by a protocol's governance smart contracts, such as ProposalCreated, VoteCast, or DelegateChanged. When these events occur, a predefined mapping function written in AssemblyScript is triggered. This function processes the raw blockchain data, interprets it according to the subgraph's schema, and stores the structured data—like proposal details, voter addresses, and voting power—in a Graph Node database. This process is called indexing.

The core of a governance subgraph is its schema, which defines the data entities and their relationships. Common entities include Proposal, Vote, Delegate, and TokenHolder. For example, a Vote entity would link to a specific Proposal and a Delegate, storing the voter's choice and voting power used. This structured data model allows for complex queries that would be prohibitively slow and expensive to execute directly against an Ethereum node using JSON-RPC calls.

Once indexed, the data is served via a GraphQL API. Developers can query this API to build dashboards, analytics pages, or feed data into other applications. A typical query might request "all proposals created in the last month, their current status, and the total votes for and against." This abstraction is crucial for governance frontends like Tally or Snapshot, which rely on subgraphs to display real-time proposal information and voting results without needing to scan the entire blockchain history for each page load.

Maintaining a governance subgraph requires ongoing management. As the underlying smart contracts upgrade or governance parameters change, the subgraph's manifest (subgraph.yaml), schema, and mapping functions must be updated and redeployed. Subgraph developers must also monitor indexing status and ensure the subgraph stays in sync with the latest chain blocks to provide accurate, up-to-date information for end-users and analysts tracking protocol governance.

key-features
ARCHITECTURE

Key Features of a Governance Subgraph

A Governance Subgraph is a specialized Graph Protocol subgraph that indexes and structures on-chain governance data, enabling efficient querying of proposals, votes, delegates, and treasury activity.

01

Proposal Lifecycle Indexing

Tracks the complete state machine of governance proposals from creation to execution. This includes:

  • Proposal creation (id, proposer, targets, calldata)
  • Voting period start and end blocks
  • Quorum and vote threshold calculations
  • Final state (e.g., Pending, Active, Canceled, Defeated, Succeeded, Queued, Executed)
02

Vote Aggregation & Delegation

Indexes individual votes and aggregates them by voter or delegate, calculating voting power at the time of each proposal. Key entities include:

  • Vote (voter, proposalId, support, weight, reason)
  • Delegate (delegator, delegatee)
  • Delegated voting power history This enables analysis of voter participation and delegate influence.
03

Treasury & Financial Governance

Monitors the protocol treasury and financial actions authorized through governance. This subgraph schema often includes:

  • Treasury transactions (amount, token, recipient, proposalId)
  • Token balances and historical snapshots
  • Grant or funding proposal payouts Provides transparency into capital allocation and fund management.
04

Delegate & Voter Profiles

Creates queryable profiles for delegates and active voters, summarizing their governance participation. Profiles typically show:

  • Voting history and consistency
  • Total voting power delegated to them
  • Proposals created
  • Voting rationale (if provided on-chain) This data is essential for delegate discovery and accountability.
05

Real-time Event Streaming

Listens for and indexes governance-related events (e.g., ProposalCreated, VoteCast, ProposalExecuted) as they are emitted on-chain. This provides:

  • Sub-second indexing of new data via The Graph's indexing nodes
  • Historical data from genesis block
  • A real-time API for applications like governance dashboards and bots.
06

Cross-Protocol Schema Standards

While each DAO's implementation differs, subgraphs often follow common schema patterns for interoperability. Standard entities include:

  • Governor (the governance contract)
  • Proposal
  • Vote
  • Token (the governance token) This allows front-end developers to build reusable interfaces for multiple protocols.
ecosystem-usage
GOVERNANCE SUBGRAPH

Ecosystem Usage & Examples

A Governance Subgraph is a specialized Graph Protocol indexer that aggregates and structures on-chain governance data for efficient querying. It is a critical infrastructure component for DAOs and governance platforms.

01

Core Function: Querying Proposal Data

The primary function is to index and serve structured data about governance proposals. This includes:

  • Proposal lifecycle states (Pending, Active, Succeeded, Executed, Defeated)
  • Voting power and delegation snapshots
  • Vote breakdowns (For, Against, Abstain) with voter addresses
  • Execution status and transaction hashes This enables dashboards and bots to efficiently track governance activity without scanning raw blockchain logs.
04

Enabling Governance Dashboards & Bots

Governance subgraphs are the data backbone for:

  • Analytics Dashboards: Platforms like Tally, Boardroom, and Snapshot use subgraphs to display voter participation, delegate rankings, and proposal history.
  • Notification Bots: Discord and Telegram bots query subgraphs for new proposals or concluded votes to alert communities.
  • Research Tools: Analysts use GraphQL queries to extract datasets for studying voter behavior and governance trends over time. Without a subgraph, each application would need to run its own complex and costly indexer.
05

Technical Schema Design

A well-designed governance subgraph schema typically includes core entities:

  • Proposal: Core entity with id, description, status, startBlock, endBlock.
  • Vote: Links a voter to a proposal with support (for/against/abstain) and weight.
  • Delegate: Tracks delegation history and current voting power.
  • Governance: Singleton entity storing protocol-wide parameters like quorum, votingDelay. The subgraph manifest (subgraph.yaml) maps these entities to specific contract events and functions for indexing.
06

Cross-Chain Governance Indexing

For protocols deployed on multiple chains, governance subgraphs must often index across networks. Examples include:

  • Aave Governance: Indexes proposals and votes across Ethereum and Polygon.
  • Optimism Collective: Tokesnhouse subgraph indexes voter data for OP token holders across L1 and L2. This requires deploying separate subgraph deployments per network and designing schemas that can unify or distinguish cross-chain data, often using a chainId field. It enables a holistic view of a DAO's activity regardless of where governance execution occurs.
technical-details
GOVERNANCE SUBGRAPH

Technical Details & Schema Design

A technical deep dive into the architecture and data schema of a subgraph designed to index and query on-chain governance data.

A Governance Subgraph is a specialized The Graph protocol subgraph that indexes and structures on-chain governance data from a blockchain protocol, such as proposals, votes, delegations, and token balances, making it efficiently queryable via GraphQL. It acts as a decentralized data pipeline, listening for specific events emitted by smart contracts (like a Governor or Timelock contract) and mapping this raw, low-level blockchain data into a structured, relational database. This abstraction is critical for building user interfaces, analytics dashboards, and automated tools that require fast, complex queries about governance activity without interacting directly with a node.

The schema design of a governance subgraph defines the entities and relationships that model the governance process. Core entities typically include Proposal (with fields for id, description, status, voteStart, voteEnd, forVotes, againstVotes), Vote (linked to a Proposal and a Voter), Delegate (representing a token holder or their delegate), and Governance (a singleton storing global protocol metrics). These entities are linked via foreign keys, enabling powerful queries like "fetch all proposals voted on by a specific delegate" or "calculate the total voting power cast in the last quarter."

Key technical details involve the subgraph manifest (subgraph.yaml), which specifies the smart contract addresses, the ABIs used to decode events, and the event handlers that trigger mapping functions. The mapping logic, written in AssemblyScript, transforms event data into the schema entities. For example, a ProposalCreated event is handled by a function that creates a new Proposal entity, populating its initial state. Careful schema design ensures the subgraph is efficient, avoids hot storage patterns, and supports the complex filtering and sorting needs of front-end applications.

Optimizing a governance subgraph for performance and cost involves strategies like field-level indexing on frequently queried fields (e.g., proposal.status), using derived fields to pre-calculate values (like a proposal's total vote count), and implementing pagination via the first and skip arguments in GraphQL queries. Developers must also handle chain reorganizations gracefully; The Graph's indexing nodes automatically rewind and correct the data in the event of a reorg, ensuring the indexed data remains consistent with the canonical chain. This reliability is paramount for trustless governance tooling.

In practice, a well-designed governance subgraph becomes the backbone for the entire governance ecosystem of a protocol. It powers snapshot.org-like interfaces, voting history explorers, delegate profile pages, and off-chain data analysis for research. By abstracting away the complexities of direct contract calls and event log parsing, it dramatically reduces the development overhead for teams building on top of governance systems and provides a single, authoritative source for querying a protocol's democratic history and state.

DATA ACCESS METHOD COMPARISON

Governance Subgraph vs. Direct RPC Calls

A comparison of two primary methods for querying on-chain governance data, highlighting trade-offs in development complexity, performance, and data richness.

Feature / MetricGovernance Subgraph (The Graph)Direct RPC Calls

Primary Function

Indexed, queryable historical data API

Direct, real-time node state query

Data Availability

Aggregated, historical events & derived state

Current blockchain state only

Query Complexity

Complex GraphQL queries (joins, filters, sorting)

Simple, single-state calls or manual log parsing

Development Overhead

Low (pre-built schema & resolvers)

High (requires custom indexing & aggregation logic)

Historical Data Access

Real-time Latency

~1-5 sec (indexer sync delay)

< 1 sec (immediate block propagation)

Data Consistency

Eventually consistent

Strongly consistent

Infrastructure Cost

Decentralized indexer network (query fees)

Self-hosted node or paid RPC provider

GOVERNANCE SUBGRAPH

Frequently Asked Questions (FAQ)

Common questions about the technical implementation, use, and purpose of governance subgraphs for on-chain decision-making.

A governance subgraph is a specialized Graph Protocol indexer that queries, processes, and serves structured data related to on-chain governance events, such as proposals, votes, and delegation. It works by listening for specific events (e.g., ProposalCreated, VoteCast) from a smart contract, indexing this data into a queryable GraphQL API, and making it efficiently accessible for front-end applications and analytics dashboards. This abstracts away the complexity of directly parsing raw blockchain logs and transaction data, enabling developers to build interfaces that display real-time proposal status, voting power distribution, and delegate activity with simple queries.

ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected Directly to Engineering Team