MAINNET:
Loading...
TESTNET:
Loading...
/
onflow.org
Flow Playground

How to Stake with Unlocked FLOW


This document outlines the steps a token holder can take to stake and manage a Flow node with normal, unlocked FLOW using the FlowIDTableStaking contract.

This guide covers staking with unlocked FLOW tokens. Please see the locked staking guide for staking with locked tokens from the Flow community sale.

Setup

Register a New Staked Node

To register as a node operator with unlocked FLOW, the token holder can use the Register Node (SC.11) transaction with the following arguments:

ArgumentTypeDescription
idStringThe ID of the new node. It must be a 32 byte String. The operator is free to choose this value, but it must be unique across all nodes. A recommended process to generate this is to hash the staking public key.
roleUInt8The role of the new node. (1: collection, 2: consensus, 3: execution, 4: verification, 5: access)
networkingAddressStringThe IP address of the new node. (Length must be less than 255 bytes (510 Hex characters))
networkingKeyStringThe networking public key as a 64 byte hex-encoded String (128 hex characters)
stakingKeyStringThe staking public key as a 96 byte hex-encoded String (192 hex characters)
amountUFix64The number of FLOW tokens to stake.

This transaction registers the account as a node operator with the specified node information and creates a public link to query the nodes ID from the account address.


Once the token holder has registered their node, their tokens and node information are committed to the central staking contract for the next epoch.

At this point, the token holder now has access to various staking operations that they can perform, assuming they have the correct number of tokens to perform the action.

Stake New Tokens

The token holder can stake additional tokens at any time.

Note: this transaction stakes additional tokens to the same node that was registered in the setup phase.

To stake new tokens, the token holder can use the Stake New Locked FLOW (SC.12) transaction with the following arguments:

ArgumentTypeDescription
amountUFix64The number of FLOW tokens to stake.

This transaction commits tokens to stake from the token holder's account.

Re-stake Unstaked Tokens

After tokens become unstaked, the token holder can choose to re-stake the unstaked tokens to the same node.

To staked unstaked tokens, the token holder can use the Re-stake Unstaked FLOW (SC.13) transaction with the following arguments:

ArgumentTypeDescription
amountUFix64The number of unstaked FLOW tokens to stake.

Re-stake Rewarded Tokens

After earning rewards from staking, the token holder can choose to re-stake the rewarded tokens to the same node.

To stake rewarded tokens, the token holder can use the Re-stake Rewarded FLOW (SC.14) transaction with the following arguments:

ArgumentTypeDescription
amountUFix64The number of rewarded FLOW tokens to stake.

Request Unstake Tokens

The token holder can submit a request to unstake some of their tokens at any time. If the tokens aren't staked yet, they will be uncommitted and available to withdraw.

To request to unstake staked tokens, the token holder can use the Request Unstaking (SC.15) transaction.

ArgumentTypeDescription
amountUFix64The number of rewarded FLOW tokens to request to un-stake.

Note: this transaction will not succeed if the node operator has delegators and the request would put the node operator below the minimum required tokens staked for their node type. Use the Unstake All transaction instead, which will also unstake all delegators.

Note: unstaked tokens will be held by the central staking contract until the end of the following epoch. Once the tokens are released (unstaked), they can be claimed via the Withdraw Unstaked Tokens action below.

Unstake All Tokens

The token holder can submit a request to unstake all their tokens at any time. If the tokens aren't staked yet, they will be uncommitted and available to withdraw.

To unstake all staked tokens, the token holder can use the Unstake All FLOW (SC.16) transaction.

This transaction requires no arguments.

Warning: this will unstake all of the user's staked tokens and unstake all of the tokens from users that are delegating FLOW to the node.

Withdraw Unstaked Tokens

After tokens become unstaked, the token holder can withdraw them from the central staking contract.

To withdraw unstaked tokens, the token holder can use the Withdraw Unstaked FLOW (SC.17) transaction with the following arguments:

ArgumentTypeDescription
amountUFix64The number of unstaked FLOW tokens to withdraw.

This transaction moves the unstaked tokens back into the FlowToken.Vault owned by the token holder.

Withdraw Rewarded Tokens

After earning rewards from staking, the token holder can withdraw them from the central staking contract.

To withdraw rewarded tokens, the token holder can use the Withdraw Rewarded FLOW (SC.18) transaction with the following arguments:

ArgumentTypeDescription
amountUFix64The number of rewarded FLOW tokens to withdraw.

This transaction moves the rewarded tokens back into the FlowToken.Vault owned by the token holder.

Stake Multiple Nodes from the Same Account

Currently, the default staking transactions can only be used as they are to stake one node per account.

If a token holder wants to create a second staking relationship using the transactions as is, they must create a new account and transfer their tokens to the new account.

It is possible to have multiple nodes per account by storing the node objects at different storage paths, but this would require small changes to these transactions to use the new storage paths.

Delegate from the Same Account

An account that registers a node can also register as a delegator from the same account. See the Delegation Guide for how to register a delegator.

Edit on GitHub