Skip to content

iam-protocol/iam-governance-plugin

Repository files navigation

IAM Voter Weight Plugin

SPL Governance voter weight plugin for IAM Protocol. Adds human liveness verification to DAO governance on Solana.

What it does

DAOs on Realms can configure this plugin to require voters to be recently verified humans with sustained behavioral history. Bots, automated scripts, and dormant wallets are excluded from governance.

Designed to layer on top of existing voter weight plugins. Chain IAM with token-voter to require both token holdings and proof of human presence. Chain with quadratic voting for verified-human quadratic weights.

How it works

  1. DAO admin calls create_registrar with a minimum Trust Score and maximum verification age
  2. Each voter calls create_voter_weight_record to initialize their record
  3. Before voting, the voter calls update_voter_weight_record which reads their IAM IdentityState PDA cross-program and checks:
    • Trust Score >= minimum configured by the DAO (proves sustained behavioral history)
    • Last verification is recent enough (proves the human is actively engaged)
  4. If both pass, voter_weight is set to 1 with a short expiry (~40 seconds)
  5. The governance program reads the VoterWeightRecord and allows the vote

The voter weight expires after ~100 slots, forcing the update to happen in the same transaction as the governance action. This prevents stale weight records from being reused.

Instructions

Instruction Purpose
create_registrar DAO admin configures min Trust Score and max verification age
update_registrar DAO admin updates configuration parameters
close_registrar DAO admin closes the registrar and reclaims rent
create_voter_weight_record Initialize a voter's weight record (born expired)
update_voter_weight_record Read IAM IdentityState, validate trust score and recency, set voter_weight = 1
close_voter_weight_record Voter closes their record and reclaims rent
create_max_voter_weight_record DAO admin initializes quorum tracking (realm authority required)
update_max_voter_weight_record DAO admin sets the max voter weight (never expires, admin-managed)

Architecture

Voter wants to cast a vote
    → calls update_voter_weight_record
    → plugin reads IAM IdentityState PDA (cross-program, no CPI)
    → checks trust_score >= min_trust_score
    → checks verification age < max_verification_age
    → sets voter_weight = 1, expiry = current_slot + 100
    → governance program reads VoterWeightRecord
    → vote is accepted

The plugin reads the IAM IdentityState account via raw byte deserialization (not Anchor CPI) to avoid version coupling with the IAM Anchor program.

Program ID

Devnet: 99nwXzcugse3x8kxE9v6mxZiq8T9gHDoznaaG6qcw534

Build

anchor build

Requires:

  • Anchor 0.31.1
  • Solana CLI 2.2.1
  • Rust 1.91.0

Test

# Generate test fixtures (one-time)
npx tsx scripts/generate-test-fixtures.ts

# Start local validator with genesis programs and fixture accounts
solana-test-validator \
  --bpf-program 99nwXzcugse3x8kxE9v6mxZiq8T9gHDoznaaG6qcw534 target/deploy/iam_voter_weight.so \
  --bpf-program GZYwTp2ozeuRA5Gof9vs4ya961aANcJBdUzB7LN6q4b2 tests/fixtures/iam_anchor.so \
  --bpf-program GovER5Lthms3bLBqWub97yVrMmEogzX7xNjdXpPPCVZw tests/fixtures/spl_governance.so \
  --account 63cKuvoe9WuNH9Ds6aXF7iSc4jHmJc4ZkxdHTaitJ5tr tests/fixtures/identity-state-a.json \
  --account 73gAPp8WuNzdHh4E5ySQNFR3jpw8qs5YFaYPp8iyt6FZ tests/fixtures/identity-state-b.json \
  --reset --quiet

# Run all tests (in a separate terminal)
npx ts-mocha -p ./tsconfig.json -t 120000 tests/**/*.ts

38 tests: 20 unit tests (byte layout, PDA derivation, validation logic) + 18 integration tests (real transactions against local validator with IAM Anchor and spl-governance loaded as genesis programs).

Dependencies

Crate Version Purpose
anchor-lang 0.31.1 Anchor framework
spl-governance-mythic 3.1.2 Realm data validation
spl-governance-addin-api-mythic 0.1.6 VoterWeightRecord type
solana-program 2.2.1 Solana runtime

Realms UI Compatibility

The Realms V2 UI supports custom voter weight plugins. Any DAO admin can configure IAM as their voter weight addin by pasting the program ID (99nwXzcugse3x8kxE9v6mxZiq8T9gHDoznaaG6qcw534) in the "Custom voting program ID" field in the realm settings. No frontend changes required.

Related

License

MIT

About

SPL Governance voter weight plugin for IAM Protocol human verification

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors