{"id":28403899,"url":"https://github.com/blockdeep/pallet-collator-staking","last_synced_at":"2026-03-01T15:34:01.808Z","repository":{"id":240917372,"uuid":"787858750","full_name":"blockdeep/pallet-collator-staking","owner":"blockdeep","description":"A simple DPoS pallet for collators in a parachain.","archived":false,"fork":false,"pushed_at":"2025-06-26T16:44:50.000Z","size":787,"stargazers_count":0,"open_issues_count":3,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-03T18:56:33.112Z","etag":null,"topics":["dpos","parachains","polkadot","polkadot-sdk","substrate"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blockdeep.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-04-17T10:11:55.000Z","updated_at":"2025-06-24T10:30:45.000Z","dependencies_parsed_at":"2024-05-21T12:58:14.676Z","dependency_job_id":"b96adaf8-be01-469d-b32a-c6839433c5c5","html_url":"https://github.com/blockdeep/pallet-collator-staking","commit_stats":null,"previous_names":["blockdeep/pallet-collator-staking"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/blockdeep/pallet-collator-staking","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockdeep%2Fpallet-collator-staking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockdeep%2Fpallet-collator-staking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockdeep%2Fpallet-collator-staking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockdeep%2Fpallet-collator-staking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blockdeep","download_url":"https://codeload.github.com/blockdeep/pallet-collator-staking/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockdeep%2Fpallet-collator-staking/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29973320,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T15:29:09.406Z","status":"ssl_error","status_checked_at":"2026-03-01T15:28:28.558Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dpos","parachains","polkadot","polkadot-sdk","substrate"],"created_at":"2025-06-01T19:11:09.145Z","updated_at":"2026-03-01T15:33:58.119Z","avatar_url":"https://github.com/blockdeep.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Collator Staking Pallet\n\nSimple DPoS pallet for staking and managing collators in a Polkadot parachain.\n\n## Overview\n\nThe Collator Staking pallet is an extension of\nthe [Cumulus Collator Selection pallet](https://github.com/paritytech/polkadot-sdk/tree/master/cumulus/pallets/collator-selection)\nand provides DPoS functionality to manage collators of a parachain.\n\nIt allows users to stake their tokens to back collators, and receive rewards proportionately.\nThere is no slashing in place. If a collator does not produce blocks as expected, they are removed from the collator set\nand all stake is refunded.\n\n## Implementation\n\nSimilar to the Collator Selection pallet, this pallet also maintains two kind of block producers:\n\n- `Invulnerables`: accounts that are always selected to become collators. They can only be removed by the pallet's\n  authority. Invulnerables do not receive staking rewards.\n- `Candidates`: accounts that compete to be part of the collator set based on delegated stake.\n\n### Rewards\n\nStaking rewards distributed to candidates and their stakers come from the following sources:\n\n- Transaction fees and tips collected for blocks produced.\n- An optional per-block flat amount coming from a different pot. This is to \"top-up\" the rewards\n  in case fees and tips are too small.\n\nThe pallet assumes all rewards are generated from existing funds on the blockchain, and **there is no inflation**\nimplemented as part of this pallet.\n\nRewards are distributed so that all stakeholders are incentivized to participate:\n\n- Candidates compete to become collators.\n- Collators must not misbehave and produce blocks honestly so that they increase the chances to produce more blocks and\n  this way be more attractive for other users to stake on.\n- Stakers must select wisely the candidates they want to deposit the stake on, hence determining the best possible\n  candidates that are likely to become collators.\n- Rewards are proportionally distributed among collators and stakers when the session ends.\n    - Collators receive an exclusive percentage of them for collating. This is configurable.\n    - Stakers receive the remaining proportionally to the amount staked in a given collator.\n\n### Staking\n\nAny account in the parachain can deposit a stake on a given candidate so that it gets access to staking rewards\nproportional to the blocks produced by the selected candidate.\n\n### Un-staking\n\nWhen a staker wishes to unstake, there is a delay: the staker will have to wait for a given number of blocks\nbefore their funds are unlocked. No rewards are given during this delay period.\n\n### Auto Compounding\n\nUsers can also select the percentage of rewards that will be auto-compounded. If the selected percentage is greater than\nzero, part of the rewards will be re-invested as stake in the collator when receiving rewards per block.\n\n### Reward delivery\n\nWhen a session ends, a snapshot of the generated rewards and the per-candidate stake is taken. This information is used\nto calculate the per-staker rewards for that session.\nStakers will have to call the `claim_rewards` extrinsic to collect the corresponding earnings from the previous\nsessions. This process will be automatically triggered whenever\nthe staker alter its stake. That is: when `stake`, `unstake` or `unstake_all` is called. Claimed rewards will then be\nauto-compounded if the user sets an auto-compound percentage greater than zero.\n\n### Runtime Configuration\n\n| Parameter                  | Description                                                                                          |\n|----------------------------|------------------------------------------------------------------------------------------------------|\n| `RuntimeEvent`             | The overarching event type.                                                                          |\n| `Currency`                 | The currency mechanism.                                                                              |\n| `RuntimeFreezeReason`      | The overarching freeze reason.                                                                       |\n| `UpdateOrigin`             | Origin that can dictate updating parameters of this pallet.                                          |\n| `PotId`                    | Account Identifier from which the internal pot is generated.                                         |\n| `ExtraRewardPotId`         | Account Identifier from which the internal extra reward pot is generated.                            |\n| `ExtraRewardReceiver`      | Account that will receive all funds in the extra reward pot when those are stopped.                  |\n| `MaxCandidates`            | Maximum number of candidates allowed.                                                                |\n| `MinEligibleCollators`     | Minimum number eligible collators including Invulnerables.                                           |\n| `MaxInvulnerables`         | Maximum number of invulnerables.                                                                     |\n| `KickThreshold`            | Candidates will be removed from active collator set, if block is not produced within this threshold. |\n| `CollatorId`               | A stable ID for a collator.                                                                          |\n| `CollatorIdOf`             | A conversion from account ID to collator ID.                                                         |\n| `CollatorRegistration`     | Validate a collator is registered.                                                                   |\n| `MaxStakedCandidates`      | Maximum candidates a staker can stake on.                                                            |\n| `MaxStakers`               | Maximum stakers per candidate.                                                                       |\n| `StakeUnlockDelay`         | Number of blocks to wait before unlocking the stake by a user.                                       |\n| `BondUnlockDelay`          | Number of blocks to wait before unlocking the bond by a collator.                                    |\n| `RestakeUnlockDelay`       | Number of blocks to wait before reusing funds previously assigned to a candidate.                    |\n| `MaxRewardSessions`        | Maximum number of per-session reward snapshots to keep in storage.                                   |\n| `AutoCompoundingThreshold` | Minimum stake needed to enable autocompounding.                                                      |\n| `WeightInfo`               | Information on runtime weights.                                                                      |\n\n### Setup Considerations\n\nWhile it is desired to set `MaxStakedCandidates` and `MaxStakers` to a reasonably high value, bear in mind this may\nsignificantly impact block weight consumption. We recommend to measure the weights and set values that in the worst case\ndo not occupy more than a sane limit, like ~10% of the block's total weight.\n\n### Dependencies\n\n#### Pallet Session\n\nThis pallet is coupled\nwith [pallet-session](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/session), as it plays the\nrole of the session manager by deciding the next collator set. Also, rewards are assigned when sessions end and start.\n\n#### Pallet Authorship\n\nThis pallet is dependent\non [pallet-authorship](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/authorship) by subscribing\nto block authorship so that it can assign rewards to collators and their stakers accordingly.\n\n### Compatibility\n\nThis pallet is compatible\nwith [polkadot release stable2407-2](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-stable2407-2) or\nhigher.\n\n## License\n\nThe code within this repository is licensed under Apache-2.0 license. See the [LICENSE](./LICENSE) file for more\ndetails.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblockdeep%2Fpallet-collator-staking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblockdeep%2Fpallet-collator-staking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblockdeep%2Fpallet-collator-staking/lists"}