Staking Contracts(1)| Basic functions of SCs

StaFi_Protocol
StaFi

--

Author : Liam ; Middle

We have posted a string of articles on Staking Finance. We want to restate that rToken will be the underlying asset in Staking Finance, and financial derivatives on the basis of rToken will be flourishing. More importantly, Stafi Protocol will be an essential infrastructure for Staking Finance and even the overall DeFi world.

As for Stafi protocol, the core ingredient of it, actually, is Staking Contracts. In the coming 3 articles, I will introduce Staking Contracts. This is the first one.

Some public chain projects will implement the Staking function at the contract level, namely Staking Contract. But in this series of articles, Staking Contract refers to a set of codes on the Stafi chain that record and update the mapping relationship between rToken and native token. Staking Contract (referred to as SC) is an indispensable part of in Stafi system. Each PoS project in Stafi, once its Staking is supported, will have an exclusive SC. When a project handles several kinds of asset, Stafi will create multiple SCs for it in order to offset risks. Meanwhile, it is a set made of many Staking Contracts(SCs), for there are plenty of PoS projects in Stafi. In all SCs, those SCs supporting XTZ staking are called XTZ_SC, and those for Atom staking are Atom_SC.

Through Staking Contracts, Stafi enables users to stake, redeem, distribute dividends, trade and so forth.

Staking

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.

Redemption

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.

In staking and redemption actions, SCs have optimized user’s experience of paying commissions.

Pledging and redemption will not only generate transaction data on the original chain, but also on Stafi. Therefore, commissions would be paid twice. Once in the form of FIS and the other native token. However, SC will directly convert the commission paid by the native token to FIS, and combine the two to one. From the user’s perspective, commission will only be charged once.

The combination of commission helps simplify complicated protocols and present users with a simple, concise interface. It is Stafi’s design philosophy to cut user’s cognition cost.

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 detailed distribution approach will be explained in the article to come.

Trade

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.

SV and SSV

SV refers to Stafi Validator. Stafi itself is a blockchain using PoS mechanism and SV is the validator of the chain. SV is responsible for recording transaction on Stafi chain (including FIS and rToken transactions), validating and block-producing.

SSV refers to Stafi Special Validator, is a group of validators with special responsibilities. If a SV stakes enough amount of FIS, it could be elected as a SSV (with a rotation system). When a user stakes, SSV need to validate the transaction on the original chain to ensure the assets on the original chain have been transferred to the multi-signature account. When a user wants to redeem, SSVs need to run the multi-signature account jointly to transfer assets back to the user, then validate the transfer. In order to realize these 2 functions, SSVs are required to run lite nodes of projects supported by SCs. The program will be written to the SSV client and execute validation automatically.

Multi-signature account

To ensure that the ownership of Staking assets is always controlled by users, not by third parties, Stafi designed an intermediate address. No one can obtain the private key of this address. Stafi achieves asset neutrality of intermediate addresses through secure multi-party computing technology and threshold multi-signature technology, ensuring that only users with rTokens can execute signatures when they initiate a redemption. The intermediate address does not have a private key, nor is it stored on the Stafi protocol. It is only formed when multiple signatures of the private keys of SSVs are required to sign.

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.

Delegation Reliability

First of all, it is acknowledged that the action of entrusting the validator in Staking must be performed by the validator itself, and tokens will not be transferred out of the multi-sign account. The delegation mechanism of some PoS chains is sophisticated enough, such as Cosmos, Carnado, Polkadot, which can support on-chain delegation and automatic profit allocation. The reliability of such projects is guaranteed at the bottom layer of the original chain. There are also some other chains that do not have a delegation mechanism (non-DPoS type), such as ETH after upgrading Casper, or a delegation mechanism without supporting on-chain profit allocation, such as Tezos. In this case, Stafi team will integrate the delegation and profit allocation contracts in the SC to achieve the reliability of the delegation.

Summary

Staking Contracts is the basic module of Stafi Protocol. It realizes 4 basic functions of Stafi Protocol: staking, redemption, transaction, and dividend payment; SCs guarantees that Staking assets are only controlled by rToken holders through SSV and multi-signature accounts. In addition, SCs has a tested solution to delegation reliability and final determinacy of the PoS chain.

In order to simplify the user’s perception, SCs unifies dividend payout to some extent. Nonetheless, this does not prevent the application layer from fulfilling the user’s diversified dividend payment requirements. Through Stafi’s application layer, a variety of functions regarding user’s earnings can be realized, such as the automatic redemption of returns, automatic donation of proceeds to a foundation, automatic lottery by returns, etc. There will be articles elaborating the possibilities of the application layer of Stafi in the future.

About Stafi Protocol

Stafi Protocol is the first decentralized protocol that provides the liquidity for Staking assets.

Website: www.stafi.io

Twitter:@Stafi_Protocol

Telegram: https://t.me/stafi_protocol

--

--

StaFi_Protocol
StaFi
Editor for

StaFi_Protocol A Decentralize Protocol to Provide the liquidity of Your Staking Assets