Direct PEP Integration
The x/pep
module can be directly incorporated into any Cosmos SDK-based application chain to enable seamless privacy integration with Fairblock's Fairyring network.
This approach provides a minimal-overhead method for allowing encrypted transactions and automatic decryption/execution flows.
Overview
By integrating the x/pep
module into your chain:
- Your chain can connect to the Fairyring chain, constantly updating its Master Public Key (MPK) and automatically retrieving decryption keys as they are generated.
- Users can submit encrypted transactions on your chain, which will be automatically decrypted and executed once the appropriate decryption keys are available from Fairyring.
This enables Cosmos chains to easily unlock confidential compute flows without having to build custom encryption/decryption pipelines.
How to Integrate
Integrating the x/pep
module is similar to integrating a standard Cosmos SDK module, such as bank
or staking
.
You need to:
- Import the
x/pep
module in your codebase. - Wire the module in your
app.go
. - Set the module parameters correctly (especially
is_source_chain = false
).
1. Import the PEP Module
In your app.go
:
import (
// other imports
pepmodule "github.com/Fairblock/fairyring/x/pep"
pepkeeper "github.com/Fairblock/fairyring/x/pep/keeper"
peptypes "github.com/Fairblock/fairyring/x/pep/types"
)
2. Add Keeper to Your App
Declare the PEP Keeper inside your App
struct:
type App struct {
// other keepers...
PepKeeper pepkeeper.Keeper
}
Then initialize it inside the NewApp
function:
app.PepKeeper = *pepkeeper.NewKeeper(
appCodec,
keys[peptypes.StoreKey],
app.GetSubspace(peptypes.ModuleName),
app.AccountKeeper,
app.BankKeeper,
)