Custom Plugin
How to create a custom plugin and attach it to Realms
Create a Custom Plugin
How Plugins Work
The VoterWeightRecord Interface
pub struct VoterWeightRecord {
/// Discriminator: sha256("account:VoterWeightRecord")[..8]
pub account_discriminator: [u8; 8],
/// The Realm this record belongs to
pub realm: Pubkey,
/// The governing token mint (community or council)
pub governing_token_mint: Pubkey,
/// The voter's wallet address
pub governing_token_owner: Pubkey,
/// The computed voter weight
pub voter_weight: u64,
/// Optional: slot when this weight expires (None = never expires)
pub voter_weight_expiry: Option<Slot>,
/// Optional: the specific governance action this weight applies to
pub weight_action: Option<VoterWeightAction>,
/// Optional: the target account for the action (e.g., a specific Proposal)
pub weight_action_target: Option<Pubkey>,
pub reserved: [u8; 8],
}The MaxVoterWeightRecord Interface
Building Your Plugin: Step by Step
1. Create the On-Chain Program
2. Key Instructions to Implement
3. Register the Plugin with a Realm
4. Build the UI Client
Existing Plugin Examples
Plugin
Description
Program ID
Testing Your Plugin
Plugin Chaining
Last updated