Skip to content

Elections pallet

Derived from live runtime metadata on TRN root (pallet index 58, captured 2026-05-02). For prose-style documentation see Elections on the curated reference side.

Pallet index
58
Calls
6
Events
7
Errors
17
Storage items
5
Constants
10

Calls (extrinsics)

Elections.vote

See [Pallet::vote].

ts
api.tx.elections.vote(votes: Vec<SeedPrimitivesSignatureAccountId20>, value: Compact<u128>)
ArgumentTypeDoc
votesVec&lt;SeedPrimitivesSignatureAccountId20&gt;Vec<T::AccountId>
valueCompact&lt;u128&gt;BalanceOf<T>

Call index: 0

Elections.remove_voter

See [Pallet::remove_voter].

ts
api.tx.elections.remove_voter()

Call index: 1

Elections.submit_candidacy

See [Pallet::submit_candidacy].

ts
api.tx.elections.submit_candidacy(candidate_count: Compact<u32>)
ArgumentTypeDoc
candidate_countCompact&lt;u32&gt;u32

Call index: 2

Elections.renounce_candidacy

See [Pallet::renounce_candidacy].

ts
api.tx.elections.renounce_candidacy(renouncing: {"_enum":{"Member":"Null","RunnerUp":"Null","Candidate":"Compact<u32>"}})
ArgumentTypeDoc
renouncing{"_enum":{"Member":"Null","RunnerUp":"Null","Candidate":"Compact&lt;u32&gt;"}}Renouncing

Call index: 3

Elections.remove_member

See [Pallet::remove_member].

ts
api.tx.elections.remove_member(who: [u8;20], slash_bond: bool, rerun_election: bool)
ArgumentTypeDoc
who[u8;20]AccountIdLookupOf<T>
slash_bondboolbool
rerun_electionboolbool

Call index: 4

Elections.clean_defunct_voters

See [Pallet::clean_defunct_voters].

ts
api.tx.elections.clean_defunct_voters(num_voters: u32, num_defunct: u32)
ArgumentTypeDoc
num_votersu32u32
num_defunctu32u32

Call index: 5

Events

Elections.NewTerm

A new term with new_members. This indicates that enough candidates existed to run the election, not that enough have has been elected. The inner value must be examined for this purpose. A NewTerm(\[\]) indicates that some candidates got their bond slashed and none were elected, whilst EmptyTerm means that no candidates existed to begin with.

FieldTypeDoc
new_membersVec&lt;(SeedPrimitivesSignatureAccountId20,u128)&gt;

Elections.EmptyTerm

No (or not enough) candidates existed for this round. This is different from NewTerm(\[\]). See the description of NewTerm.

No payload.

Elections.ElectionError

Internal error happened while trying to perform election.

No payload.

Elections.MemberKicked

A member has been removed. This should always be followed by either NewTerm or EmptyTerm.

FieldTypeDoc
member[u8;20]

Elections.Renounced

Someone has renounced their candidacy.

FieldTypeDoc
candidate[u8;20]

Elections.CandidateSlashed

A candidate was slashed by amount due to failing to obtain a seat as member or runner-up. Note that old members and runners-up are also candidates.

FieldTypeDoc
candidate[u8;20]
amountu128

Elections.SeatHolderSlashed

A seat holder was slashed by amount by being forcefully removed from the set.

FieldTypeDoc
seat_holder[u8;20]
amountu128

Errors

Elections.UnableToVote

Cannot vote when no candidates or members exist.

Elections.NoVotes

Must vote for at least one candidate.

Elections.TooManyVotes

Cannot vote more than candidates.

Elections.MaximumVotesExceeded

Cannot vote more than maximum allowed.

Elections.LowBalance

Cannot vote with stake less than minimum balance.

Elections.UnableToPayBond

Voter can not pay voting bond.

Elections.MustBeVoter

Must be a voter.

Elections.DuplicatedCandidate

Duplicated candidate submission.

Elections.TooManyCandidates

Too many candidates have been created.

Elections.MemberSubmit

Member cannot re-submit candidacy.

Elections.RunnerUpSubmit

Runner cannot re-submit candidacy.

Elections.InsufficientCandidateFunds

Candidate does not have enough funds.

Elections.NotMember

Not a member.

Elections.InvalidWitnessData

The provided count of number of candidates is incorrect.

Elections.InvalidVoteCount

The provided count of number of votes is incorrect.

Elections.InvalidRenouncing

The renouncing origin presented a wrong Renouncing parameter.

Elections.InvalidReplacement

Prediction regarding replacement after member removal is wrong.

Storage

Elections.Members

The current elected members. Invariant: Always sorted based on account id.

ts
await api.query.elections.members()

Returns: Vec<PalletElectionsPhragmenSeatHolder>

Modifier: Default

Elections.RunnersUp

The current reserved runners-up. Invariant: Always sorted based on rank (worse to best). Upon removal of a member, the last (i.e. best) runner-up will be replaced.

ts
await api.query.elections.runnersUp()

Returns: Vec<PalletElectionsPhragmenSeatHolder>

Modifier: Default

Elections.Candidates

The present candidate list. A current member or runner-up can never enter this vector and is always implicitly assumed to be a candidate. Second element is the deposit. Invariant: Always sorted based on account id.

ts
await api.query.elections.candidates()

Returns: Vec<(SeedPrimitivesSignatureAccountId20,u128)>

Modifier: Default

Elections.ElectionRounds

The total number of vote rounds that have happened, excluding the upcoming one.

ts
await api.query.elections.electionRounds()

Returns: u32

Modifier: Default

Elections.Voting

Votes and locked stake of a particular voter. TWOX-NOTE: SAFE as AccountId is a crypto hash.

ts
await api.query.elections.voting(key1)
  • Key: [u8;20] (hasher: Twox64Concat)
  • Returns: {"votes":"Vec<SeedPrimitivesSignatureAccountId20>","stake":"u128","deposit":"u128"}

Modifier: Default

Constants

Elections.PalletId

Identifier for the elections-phragmen pallet's lock

Type: [u8;8]
SCALE-encoded value: 0x706872656c656374

Elections.CandidacyBond

How much should be locked up in order to submit one's candidacy.

Type: u128
SCALE-encoded value: 0x002f6859000000000000000000000000

Elections.VotingBondBase

Base deposit associated with voting. This should be sensibly high to economically ensure the pallet cannot be attacked by creating a gigantic number of votes.

Type: u128
SCALE-encoded value: 0xe4010000000000000000000000000000

Elections.VotingBondFactor

The amount of bond that need to be locked for each vote (32 bytes).

Type: u128
SCALE-encoded value: 0xc0000000000000000000000000000000

Elections.DesiredMembers

Number of members to elect.

Type: u32
SCALE-encoded value: 0x05000000

Elections.DesiredRunnersUp

Number of runners_up to keep.

Type: u32
SCALE-encoded value: 0x03000000

Elections.TermDuration

How long each seat is kept. This defines the next block number at which an election round will happen. If set to zero, no elections are ever triggered and the module will be in passive mode.

Type: u32
SCALE-encoded value: 0x77010000

Elections.MaxCandidates

The maximum number of candidates in a phragmen election. Warning: This impacts the size of the election which is run onchain. Chose wisely, and consider how it will impact T::WeightInfo::election_phragmen. When this limit is reached no more candidates are accepted in the election.

Type: u32
SCALE-encoded value: 0x40000000

Elections.MaxVoters

The maximum number of voters to allow in a phragmen election. Warning: This impacts the size of the election which is run onchain. Chose wisely, and consider how it will impact T::WeightInfo::election_phragmen. When the limit is reached the new voters are ignored.

Type: u32
SCALE-encoded value: 0x00020000

Elections.MaxVotesPerVoter

Maximum numbers of votes per voter. Warning: This impacts the size of the election which is run onchain. Chose wisely, and consider how it will impact T::WeightInfo::election_phragmen.

Type: u32
SCALE-encoded value: 0x10000000

Source: live chain metadata from wss://root.rootnet.live/archive/ws · captured 2026-05-02

Curated independently by Codeology. Source-attributed reference for The Root Network. Not affiliated with Futureverse / TRN Labs.