Staking Contracts

A Staking Contract refers to a set of codes that record and update the mapping relationship between rToken and native token on the Stafi chain. It is referred to as SC.

Stafi will generate a SC for each Staking that supports a PoS project. As the amount of Staking assets to a project increases, Stafi will create multiple SCs for this project to lower the risk. Meanwhile, Stafi supports multiple PoS projects. Strictly speaking, SC should be in its plural form, SCs, which means this is a set of contracts, but for simplicity, we still use SC. In all SC, Staking Contracts that support XTZstaking are called XTZ_SC, and those supporting Atom staking are called Atom_SC. Through SC, Stafi users can Stake, redeem, obtain dividends, trade and so forth.


When a client apply for Staking on Stafi. At first, SC will store client’s token delegated by the client into a multi-signature account, which is a special account created by SC on the original chain. This account is jointly controlled by more than one Stafi Special Validators(SSVs). Not a single one of them can take control alone. Then SC is engaged in Staking by delegating the token in the multi-signature account to the trusted validator on the original chain. Finally, SC generates the corresponding number of rTokens and issue them to Staker’'s Stafi account, which marks the completion of a Staking action.


When a user applies for redemption on Stafi, SC will first lock the rTokens in the user's Stafi account and initiate a cancellation of entrusted staking. When the lock-up period is due, SC will transfer the tokens of the multi-sign account back to the user's account (this process requires SSV signature validation). When the transfer is done, the locked rTokens will be burnt, and the redemption process is complete.

The whole process takes 2-21days due to the lock-up period of PoS.

Distribute Dividends

It refers to the process of distributing Staking revenue, in the form of rToken, which will be settled at a fixed frequency. When distributing, SC will communicate with the original chain, acquire specific data, then renew the amount of rToken in each account.

The settlement takes a uniformed and fixed frequency. The frequency of delegated validator giving dividends to multi-signature account is the same as that of block-producing, which varies from seconds to several minutes depending on what PoS chain it is. However, SCs will uniformly handle the settlement, such as once a day (can be voted out by token holders). It thus can reduce the interactions with the original chain, saving resources.

Besides, Stafi unifies all delegator’s dividend distribution of the same token, to give user’s a more stable expectation. This is similar to many mining pools in PoW world.


The transaction process does not need to interact with the original chain. When user A requests to transfer rToken to user B, SC only transfer the rToken in user A's Stafi account to user Bs’. At the same time, the redemption right and dividends represented by rToken will be automatically transferred from user A to user B. At the next dividend payout time after the transaction is completed, Staking proceeds will be settled to user B.

The Final Determinacy

The models of most PoS chains are immutable once a block is produced. As long as the transaction is packaged into a block, the transaction cannot be tampered with. Some other PoS chains are probabilistically determined, which is similar to Bitcoin. That is to say, a transaction cannot be ensured until a few blocks are confirmed. Because of this, SCs will have a waiting period when handle staking, redemption and dividend payment. If the transaction is not successfully written to the chain, SCs will also give users feedback on the failure of the operation, which avoids the inconsistency between the data of Stafi and that on the original chain.