summary: Stafi (short for Staking Finance) is a DeFi (Decentralized Finance) protocol that aims to unlock liquidity of staked assets.
content: 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. ABT token increases the staking rate to a higher level (100%, theoretically), and it could be tradable, its security is guided by STAFI Protocol which ensure ABT token is the only collateral that can apply to redeem staking asstes from original staking blockchain ( Tezos, Cosmos, Polkadot, etc,.). Overview StaFi is a combined abbreviation of Staking+Finance. It is a decentralized protocol built with the Substrate. The contract layer is composed of multiple staking contracts, and the application layer is mainly trading platform of rTokens. 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. Any third party can establish a decentralized bonded assets exchange using the Stafi protocol to at the application layer. All rToken exchanges share the depth of the transaction. With the increasing number of public chains adopting PoS launching their mainnets, the number and variety of Stake's tokens will rocket. And rTokens will traded more frequently. As a result, developers will be hugely rewarded, in the form of transaction fee, from rToken transactions they initiated. Implementation 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. Multi-signature Adresses Stake models rely on the Account model—when the user initiates Staking, they need a private key of the original chain address to sign. In order to ensure the exclusive correspondence between the ownership of the Stake asset and rTokens, Stafi designed an intermediate address model. The ownership of assets in that address does not belong to anyone, meaning that no one can own the private key of this address. Stafi guarantees asset neutrality of intermediate addresses through secure multi-party computing technology and threshold multi-signing technology, ensuring that signatures are only performed when the holder of rTokens initiates a redemption. Secure multi-party computing involves privacy, which requires a group of certifiers with special functions in Stafi to participate. A certain number of validators, who are called Stafi Special Validator (SSV) are signed by their own private keys and transmitted through a secure channel to verify the validity of the signature, and, finally, realize the restoration of intermediate address signature. This intermediate address does not have a private key, nor is stored on the Stafi protocol. It is formed by the signature of the private certificate of the special authenticator only when the signature is required. The implementation of threshold multi-signing technology realizes that part, not all, of generators can generate the private key signature, which can greatly satisfy the need for the signature. For example, a multi-sign address establishes contact through a public key of multiple validators (say 21). When a person holding rTokens needs to initiate a redemption, only 16 signatures of 21 verifying servers are required to verify Staking and Unstake for Stake Assets. Secure Multi-Party Computation Secure multi-party computation mainly focuses on how to safely calculate a predefined function without the existence of untrusted third parties, addressing a problematic reality that a result reliant on multi-party data calculation where those parties are not willing to share the original data. With secure multi-party computation, the final result can be verified without revealing the initial input value to another third party. In Stafi's Staking contract, the user who stakes must generate a new multi-signal address. When the holder of the rToken initiates a redemption to the Stake Contract, the multi-signature address needs to create a private key signature with the involvement of special validators during calculation and generation. The validators transmit the calculation results through the encrypted channel, and they can mutually verify the results without the need to reveal their own private key. It is secured way of unlocking and redeeming the Staking Contract. Ownership Transfer When the Staking operation is completed, the redemption right of XTZ on the multi-sign address is in the hands of the holder of rXTZ. Only the holder of rXTZ has the right to redeem the XTZ-SC, other holders entitled no redemption rights. If user A traded XTZ to user B, then user A loses the redemption right to the original chain XTZ, and the mapping relationship between the XTZ and the user A address of the multi-signed address in the contract is also given to that with B. User B can initiate redemption according to his or her own wishes, or trade rTokens to other people. In this process, the multi-sign address completes multiple rounds of ownership of the original chain XTZ through the signature of special validators on Stafi who are different to that in Polkadot world—it does not requires block-producing consensus. The requirements come in only when generating the address and the changes of ownership.When use