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].
api.tx.elections.vote(votes: Vec<SeedPrimitivesSignatureAccountId20>, value: Compact<u128>)| Argument | Type | Doc |
|---|---|---|
votes | Vec<SeedPrimitivesSignatureAccountId20> | Vec<T::AccountId> |
value | Compact<u128> | BalanceOf<T> |
Call index: 0
Elections.remove_voter
See [
Pallet::remove_voter].
api.tx.elections.remove_voter()Call index: 1
Elections.submit_candidacy
See [
Pallet::submit_candidacy].
api.tx.elections.submit_candidacy(candidate_count: Compact<u32>)| Argument | Type | Doc |
|---|---|---|
candidate_count | Compact<u32> | u32 |
Call index: 2
Elections.renounce_candidacy
See [
Pallet::renounce_candidacy].
api.tx.elections.renounce_candidacy(renouncing: {"_enum":{"Member":"Null","RunnerUp":"Null","Candidate":"Compact<u32>"}})| Argument | Type | Doc |
|---|---|---|
renouncing | {"_enum":{"Member":"Null","RunnerUp":"Null","Candidate":"Compact<u32>"}} | Renouncing |
Call index: 3
Elections.remove_member
See [
Pallet::remove_member].
api.tx.elections.remove_member(who: [u8;20], slash_bond: bool, rerun_election: bool)| Argument | Type | Doc |
|---|---|---|
who | [u8;20] | AccountIdLookupOf<T> |
slash_bond | bool | bool |
rerun_election | bool | bool |
Call index: 4
Elections.clean_defunct_voters
See [
Pallet::clean_defunct_voters].
api.tx.elections.clean_defunct_voters(num_voters: u32, num_defunct: u32)| Argument | Type | Doc |
|---|---|---|
num_voters | u32 | u32 |
num_defunct | u32 | u32 |
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, whilstEmptyTermmeans that no candidates existed to begin with.
| Field | Type | Doc |
|---|---|---|
new_members | Vec<(SeedPrimitivesSignatureAccountId20,u128)> |
Elections.EmptyTerm
No (or not enough) candidates existed for this round. This is different from
NewTerm(\[\]). See the description ofNewTerm.
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
NewTermorEmptyTerm.
| Field | Type | Doc |
|---|---|---|
member | [u8;20] |
Elections.Renounced
Someone has renounced their candidacy.
| Field | Type | Doc |
|---|---|---|
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.
| Field | Type | Doc |
|---|---|---|
candidate | [u8;20] | |
amount | u128 |
Elections.SeatHolderSlashed
A seat holder was slashed by amount by being forcefully removed from the set.
| Field | Type | Doc |
|---|---|---|
seat_holder | [u8;20] | |
amount | u128 |
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
Renouncingparameter.
Elections.InvalidReplacement
Prediction regarding replacement after member removal is wrong.
Storage
Elections.Members
The current elected members. Invariant: Always sorted based on account id.
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.
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.
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.
await api.query.elections.electionRounds()Returns: u32
Modifier: Default
Elections.Voting
Votes and locked stake of a particular voter. TWOX-NOTE: SAFE as
AccountIdis a crypto hash.
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
wss://root.rootnet.live/archive/ws · captured 2026-05-02