An example integration for an IBC v2 transfer stack using the callbacks middleware can be found in the ibc-go module integration section
Pre-requisite Readings
The callbacks middleware, as the name suggests, plays the role of an IBC middleware and as such must be configured by chain developers to route and handle IBC messages correctly. For Cosmos SDK chains this setup is done via theapp/app.go
file, where modules are constructed and configured in order to bootstrap the blockchain application.
Configuring an application stack with the callbacks middleware
As mentioned in IBC middleware development an application stack may be composed of many or no middlewares that nest a base application. These layers form the complete set of application logic that enable developers to build composable and flexible IBC application stacks. For example, an application stack may just be a single base application liketransfer
, however, the same application stack composed with packet-forward-middleware
and callbacks
will nest the transfer
base application twice by wrapping it with the callbacks module and then packet forward middleware.
The callbacks middleware also requires a secondary application that will receive the callbacks to implement the ContractKeeper
. The wasmd contract keeper has been implemented here and is referenced as the WasmKeeper
.
Transfer
See below for an example of how to create an application stack usingtransfer
, packet-forward-middleware
, and callbacks
. Feel free to omit the packet-forward-middleware
if you do not want to use it.
The following transferStack
is configured in app/app.go
and added to the IBC Router
.
The in-line comments describe the execution flow of packets between the application stack and IBC core.