Integrate the Alliance module
Alliance can be integrated into both new and existing blockchains. It is an isolated module that doesn’t modify any existing CosmosSDK code. New blockchains can simply import the module and existing chains can perform a software upgrade.
Chains that want to create an Alliance must enable the following modules:
- x/auth: retrieve information about internal blockchain accounts
- x/bank: mint, burn or send coins
- x/staking: bond, unbond, delegate tokens and hooks
- x/distribution: withdraw rewards
- x/gov: create Alliances through governance
Since Interchain Security is based on the IBC standard, the Alliance module has an indirect dependency on x/ibc to bridge foreign tokens. Alliance allows any ADR 024 compliant token to be staked as long as it has been whitelisted.
Prerequisites
The Alliance Module requires:
- CosmosSDK v0.46.x or greater
- The following fully-operational modules:
Configuring and Adding Alliance to a CosmosSDK Chain
Refer to the example pull request for an implementation of the following steps.
- Add the Alliance package to the
go.mod
file with the latest released version and install it.
- Add the following modules to
app.go
- Register the AllianceKeeper in
App struct
.
- Add the Alliance module into the BasicManager instantiation.
- Add the Alliance module to the app. The Alliance module needs to be specified after the
stakingKeeper
is instantiated.
- Add the Alliance staking hooks to
app.StakingKeeper
.
- Add the requisite Alliance module types to the module account permissions.
- Add the alliance storekey to the KVStore.
- Add the Alliance module to the app manager and simulation manager instantiations.
- Add the module as the final element to the following:
SetOrderBeginBlockers
SetOrderEndBlockers
SetOrderInitGenesis
- Add the Alliance proposal handler route to the governance module.
- Add the governance proposal handlers.
- Block the module account address.
- Add the init params keepers.
- Add the Alliance package to the
go.mod
file with the latest released version and install it.
- Add the following modules to
app.go
- Register the AllianceKeeper in
App struct
.
- Add the Alliance module into the BasicManager instantiation.
- Add the Alliance module to the app. The Alliance module needs to be specified after the
stakingKeeper
is instantiated.
- Add the Alliance staking hooks to
app.StakingKeeper
.
- Add the requisite Alliance module types to the module account permissions.
- Add the alliance storekey to the KVStore.
- Add the Alliance module to the app manager and simulation manager instantiations.
- Add the module as the final element to the following:
SetOrderBeginBlockers
SetOrderEndBlockers
SetOrderInitGenesis
- Add the Alliance proposal handler route to the governance module.
- Add the governance proposal handlers.
- Block the module account address.
- Add the init params keepers.
Configuring the Bank Module
Because the Alliance module mints and burns native staking tokens when rebalancing voting power, a chain's Total Supply API needs to be updated to return accurate results. This custom wrapper only affects the following APIs: /cosmos/bank/v1beta1/supply
& /cosmos/bank/v1beta1/supply/by_denom
. Follow these instructions to update your API for supply accuracy.
- Update the imports to use a custom wrapper over the Bank module.
- Add a line to register the keepers that the custom Bank module needs
- Update the imports to use a custom wrapper over the Bank module.
- Add a line to register the keepers that the custom Bank module needs