Emmanuel Ramsey
5 min readApr 30, 2021

StaFi protocol

StaFi (short for Staking Finance) is a DeFi (Decentralized Finance) protocol that aims to unlock liquidity of staked assets. STAFI Protocol solves the contradiction between the token liquidity and Mainnet security by issuing ABT tokens, which provides the liquidity of your Staking Assets.

Stafi is a decentralized protocol that empowers liquidity. It encompasses 3 layers — bottom, contract and application layers. The bottom layer is mainly based on a blockchain system established by Substrate (which is a blockchain architecture developed by Parity, and the whole architecture integrates many development modules, including consensus module, P2P module, Staking module, etc.). The contract layer support creating a variety of Staking contracts, such as Staking contracts for XTZ, Atom and Dot respectively. The token holder can Stake through Staking Contract, which is consistent with the inflation incentives obtained by the ordinary Stake. But the difference is that The holder also can obtain rTokens. Last, the application layer supports third-party Stafi-based APIs or customized APIs to create a decentralized bondeds asset trading market for rTokens to circulate, transfer, and trade on the Stafi protocol.

The protocol runs in a purely decentralized manner. Stafi, which is built on Substrate, will be connected to Polkadot as a parallel chain, sharing the underlying consensus of Polkadot. The main security and performance are also guaranteed by Polkadot. The core layer is the contract level, and the ownership of the Stake token is fully guaranteed by the contract code. Stafi uses a distributed key storage protocol to ensure the security of the Stake address through multi-signatures. The holder can initiate Stake or redeem the Stake anytime and anywhere without the need for third party intervention. When the holder of the coin initiates the Stake token to the Stake contract, the system’s inflation incentives can be obtained regularly. Meanwhile, any holder of rTokens can initiate a redemption to the corresponding Stake contract anytime, anywhere (The redemption operation interacts with the original chain through the Stafi protocol. After the redeeming transaction is written to the chain, Stake coins will be sent to the submitted coin account after unlocked.) The Stafi protocol guarantees that each and every alternative rToken is exclusively correspond to the token on the original chain. That is to say, only the holder of the rTokens can initiate the redemption of the original token to the Stake contract. When A trades rTokens to B, A no longer has the redemption right to those tokens, and B now can initiate redemption to the Staking contract. The whole process does not require third party intervention.

StaFi protocol is meant to establish a Staking Contract at the upper level, so that the holder can initiate a Stake through the designated Contract, and at the same time obtain rTokens, an alternative token. The rTokens can trade their possessions at the bonded assets exchange built on the application layer. The holder’s Stake process and the rToken issuance process are both automatically executed by the contract code. There is no need for any third party endorsement, and the user holding the Stake token can initiate Stake or redeem at any time, the contract will be automatically executed once the validation is passed. Except for the absence of third-party intervention, the entire rToken distribution rights are given back to the original chain token holders. Further, holders can issue the value-bearing bonded assets of the corresponding value, which is similar to the current method of asset securitization. The biggest difference is that it is each and every individual, but not institutions, who issues bonded assets. The meaning of individual issuance is to resist volatility. Therefore, in theory, this decentralized method should better motivate the original chain holder to obtain rTokens. To this end, the number of rTokens on the market will also become sufficient to prop up the bonned assets bond trading market. Meanwhile, this decentralized model will reversely stimulate the trading of bonded assets, thereby reducing the spot transactions. As a result, the great picture of mass issuance and trading of bonded assets will be finally realized.

StaFi Staking Contract

The contract that creates the interaction with the Stake original chain at the Stafi contract level is called Staking Contract (referred to as SC). For example, to create a XTZ-SC for connecting Tezos with Stafi. When user A holding XTZ initiates a Stake operation on XTZ-SC, the Staking Contract will first create a multi-signature address, and he will transfer XTZ through the Tezos original chain to that address.When the transfer succeeds, the contract will execute the Staking operation of the multi-sign address. If succeed, the tokens will be locked to the original chain. Then, the Stafi protocol will receive a proof of the Tezos original chain (Proofs), and then trigger the contract to generate rXTZs of equal quantities to XTZ and send them to the staker.

The update of the Staking Contract requires the original chain and the Stafi protocol to work together, for the contract status of each chain needs to be monitored, the implementation of the Staking contract shares many similarities with the cross-chain mechanism. When the holder initiates a Staking request at the Staking Contract, the generation of the multi-sign account occurs on the Stafi protocol. At the same time, the transfer of the personal asset to the multi-sign address is completed by the Stake user’_s signature. This transfer occurs on the original chain. When the Contract captures the transfer information, a Stake request is initiated from the multi-sign address to the original chain. After the Staking is completed on the original chain, Stafi captures the Stake state of the address on the original chain and verifies it,and the corresponding rTokens are issued on the Stafi protocol immediately after the validation succeeds. Throughout the process, the Stafi protocol interacts with the original chain multiple times. The monitoring and capturing of the state plays an important role in the security of the entire protocol. The Stafi protocol captures the original state by time delay and multi-pass validation to ensure the final authenticity of the original chain. Fortunately, better than pre-existing inter-chain protocols and PoW consensus, most PoS projects launched after later 2015 see the final authenticity of block transactions as a demand that must be met. That is, when the latest height is formed, the transactions included are deterministic. At present, the common solution for the final authenticity or timely deterministic implementation is to verify the legality of the transaction before packaging the transaction to a new height. This implementation relies on the Byzantine fault-tolerant(BFT) algorithm and some artificially specified fork penalty mechanism, Slash. In view of this, the Stafi protocol has greatly improved security when interacting with the original PoS consensus chain.

Conclusion

staFi Protocol ensures system security. Contractable. Every staking is controlled by an individual staking contract which connects to the original blockchain directly. Staking assets will be secure and can only be redeemed by the rToken holders.