Tezos refers to their staking process as baking, however, throughout this document we refer to it as staking. There is no minimum requirement for asset delegation, and staked assets are not locked. However, there is an activation period of about 35 days before staked assets begin to accrue rewards.
Reward distribution
There is no limit to the total amount of staking nodes in the network. Therefore, rewards granted for staking vary in quantity depending on the level of total network participation. A fee to the delegated node is deducted from rewards for token holders who delegate their assets to a node.
Following the activation period, rewards are calculated and distributed approximately every three days. Staking rewards are sent to the wallet used for staking and are automatically added to the total amount staked.
Staking XTZ in Fireblocks
Before setting up Tezos staking on Fireblocks, complete all prerequisites for staking. Name the dedicated vault account "XTZ Staking."
The entire balance of an XTZ wallet is staked or unstaked. Rewards are sent to the same wallet and are staked automatically. Transferring assets to the staked wallet increases the total amount staked. Withdrawing rewards or any amount of the staked balance can be done at any time but a minimum of 0.25 XTZ must remain in the staked wallet until the wallet is unstaked. The staked balance is recorded and updated to reflect any changes at the beginning of each epoch.
Staking and unstaking XTZ
These commands are part of the reference SDK (TypeScript) provided by Fireblocks to help interact with the Fireblocks API and Tezos network and can be embedded in your infra flows.
Download and install the Fireblocks Tezos Staking SDK. All parameters are defined in the table below.
Staking
To stake the entire balance of an XTZ wallet use the command below. This should be the first outgoing transaction from this address. You can stake an already existing wallet.
setDelegate(fireblocks, url, destination, vaultAccountId, reveal);
Unstaking
To unstake the entire XTZ wallet balance:
setDelegate(fireblocks, url, "", vaultAccountId, reveal=false);
Example
The following is a code example of using setDelegate to stake XTZ.
import fs from "fs";
import path from "path";
import { FireblocksSDK } from "fireblocks-sdk";
import { setDelegate } from "./src/xtz-staker";
const apiSecret = fs.readFileSync(path.resolve(__dirname, "secret_key_path"), "utf8");
const apiKey = "api_key";
const fireblocks = new FireblocksSDK(apiSecret, apiKey);
// Consts for delegation:
// Tezos Public RPC url
const url: string = "https://rpc.tzbeta.net/"; //testnet: https://testnet-tezos.giganode.io
const destination: string = "baker_address";
const vaultAccountId = 'vault_account_id'
const reveal = false;
/* Set Delegate Operation: Params:
1. FireblocksSDK instance
2. Tezos public RPC url
3. Destination baker's address (tz1...)
4. Vault account ID of the source
5. Reveal - "true" in case the source address should be revealed (No any historical outgoing transaction)
NOTE: "REVEAL" should be done only on the FIRST OUTGOING source wallet's operation!
NOTE: For undelegate - pass empty string as destination
*/
setDelegate(fireblocks, url, destination, vaultAccountId, reveal);
Script parameters
Parameter | Definition |
Fireblocks | The FireblocksSDK instance. This parameter value should be hardcoded. |
url | The Tezos public RPC URL. |
destination |
Staking - The validator address. This is also called the baker's address and is provided by the staking provider. Unstaking - Value should be an empty string. |
vaultAccountID |
The dedicated Fireblocks vault account ID contains the XTZ wallet. The vault account ID can be obtained via the Fireblocks API or the Fireblocks Console. |
reveal |
False: Only if the wallet has already sent outgoing transactions. True: There have been no previous outgoing transactions from this wallet. |