Options for Building Staking Integrations
This document describes the three different methods for staking at a high level.
We highly recommended you use the Staking Collection paradigm, as this will be the most supported method for staking with any set up, including locked FLOW.
Staking Collection
A Staking Collection is a resource that allows its owner to manage multiple staking objects in a single account via a single storage path, and perform staking actions using both locked and unlocked Flow. It also supports machine accounts, a necessary feature for Flow epoch node operation.
The staking collection paradigm is the most flexible of the three choices and will receive the most support in the future. It is the set-up that Flow Port and many other staking providers use.
The staking collection setup and guide is detailed in the staking collection guide.
Basic Staking
The basic method to stake is to stake directly with the FlowIDTableStaking
smart contract.
This would involve calling the node or delegator registration functions directly in the staking
contract and storing the staking objects directly in account storage.
This is probably the simplest way to do it, but it is not very flexible and not recommended.
The basic staking guide is detailed here
Locked Tokens Staking
This method is what almost all of the participants in the Flow Community sale originally used for staking. It involves creating a secondary account that holds the user's locked tokens from the sale. A capability is created for the secondary account that allows the user's main account to register to stake and perform staking actions with the locked tokens without allowing them to actually withdraw any of the locked tokens to their primary account.
The locked account setup is detailed in the locked account setup page and the locked account staking guide.
This version is only recommended if you are dealing with locked tokens, but even if you are using locked tokens, it is recommended that you follow the locked account setup, then use the staking collection for managing staking objects.