For the complete documentation index, see llms.txt. This page is also available as Markdown.

Integrate Realms

Integrate Realms Into Your Stack

Integrate Realms Into Your Stack

This guide covers how to integrate SPL Governance (Realms) into your application, whether you're building a DeFi protocol, NFT project, or any on-chain application that needs decentralized decision-making.

Integration Approaches

1. Use Realms as Your Upgrade Authority

The simplest integration: let your DAO control program upgrades.

# Transfer program upgrade authority to your DAO wallet
solana program set-upgrade-authority <PROGRAM_ID> \
  --new-upgrade-authority <DAO_WALLET_ADDRESS>

The DAO Wallet is the native treasury PDA derived from your Governance account. Once transferred, all program upgrades must go through a governance vote.

2. Use the DAO Wallet as Admin Authority

If your program has admin/authority accounts, point them to the DAO Wallet:

// In your program's initialize instruction
pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
    let config = &mut ctx.accounts.config;
    config.authority = dao_wallet_address; // DAO controls this program
    Ok(())
}

Any instruction in your program that requires this authority can now only be executed through a governance proposal.

3. SDK Integration

Install

Read Governance Data

Create Governance Actions

The SDK uses a builder pattern where all instruction-building functions are prefixed with with and push instructions onto a TransactionInstruction[] array:

4. Embed Governance in Your dApp

Display governance data within your own frontend:

5. Plugin Integration

If your protocol has a custom token model (staking, locking, etc.), build a governance plugin so your token holders can vote with their staked/locked tokens. See Create a Custom Plugin for details.

Architecture Patterns

Pattern A: Governance-Controlled Protocol

Pattern B: Multi-Governance Setup

Create multiple governances within a single realm for different security tiers:

Pattern C: Council + Community Hybrid

Use a council for quick decisions and community for major changes:

Deployment Models

Shared Instance (Quick Start)

Use the public governance program instance:

Own Instance (Maximum Control)

Deploy your own instance for full sovereignty:

This way your DAO governs its own governance program - no external party can change the rules.

SPL Token 2022 Support

SPL Governance v3.1.2 supports Token-2022 (Token Extensions) for both community and council mints. Pass the appropriate GoverningTokenConfigAccountArgs with the token type when creating the realm:

Last updated