Integrate rToken in Cosmos
There are 2 ways for Cosmos Eco projects to integrate into StaFiHub to get their own liquid staking derivatives.
- Integrating with Interchain Accounts(ICA): It is a more decentralized way that enables the chain security to maintain rToken among Cosmos-SDK based projects, if which have already integrated Interchain accounts module.
- Integrating with Multisig Accounts: We provide this way to support projects that do not support ICA yet. rToken security relies on the chain security and offchain relay. If ICA is supported in the future, it will migrate to the way of using ICA.
It is highly recommended to read interchain-accounts introductions before moving on
With the release of Interchain Accounts, which enables cross-chain account management built upon IBC, a solution to build rTokens via Interchain Accounts is implemented on StaFiHub and brings more security, decentralization and ease of integration.
The target chain is assumed to have integrated Interchain Accounts(ICA) module.
Like the way to integrate with multisig accounts, no development is required at all, the integration process is also a three-step process and the main step is to configure the following parameters, of which most are the same except pool accounts, the other two steps are the same and we won't belabor it here.
As the target chain already supports the ICA module, StaFiHub can register ICA accounts on the target chain through its module Ledger and use them as ICA pool accounts.
During the registration process, the module Ledger plays the role as the
Authentication Module, while StaFiHub is the
Controller Chain, and the target chain is the
In order to make it easily and quickly for other Cosmos Eco projects without integrated ICA features to get their own liquid staking derivatives, StaFiHub has developed a Liquid Staking SDK and identified a complete integration process.
In general, integrating a new rToken does not require any development, mainly to run the rToken relay service.
The whole program is divided into three parts:
Based on cosmos-sdk, the on-chain module implements rToken-related functions, such as mint rToken, unbond function for user, exchange rate update, etc. In addition, there are some modules for rToken application scenarios, such as rDEX.
When integrating a new rToken, the StaFiHub chain does not require additional development, only need to register the relevant information of the new rToken.
rToken relay service
It mainly deals with cross-chain related logic (similar to the functions as a cross-chain bridge). Multiple relay nodes jointly manage multi-signature accounts and initiate related multi-signature transactions, such as delegate, undelegate, and withdrawDelegationReward on the target chain, and also need to interact with the StaFiHub chain.
The front-end interactive DApp, on which users can stake the target chain token, unbond the token, participate in DEX transactions, etc. StaFiHub holds the app that integrates all rTokens, and you can easily add a new chain configuration to integrate a new rToken.
The above rToken relay service and the DApp are also openly designed, and the access party can also do some customized logic and design based on this, or run the DApp independently, etc.
Here are the detail steps about the entire integration process of the SDK.