|
| 1 | +<!-- |
| 2 | +order: 1 |
| 3 | +--> |
| 4 | + |
| 5 | +# IBC Applications |
| 6 | + |
| 7 | +Learn how to build custom IBC application modules that enable packets to be sent to and received from other IBC-enabled chains. {synopsis} |
| 8 | + |
| 9 | +This document serves as a guide for developers who want to write their own Inter-blockchain Communication Protocol (IBC) applications for custom use cases. |
| 10 | + |
| 11 | +Due to the modular design of the IBC protocol, IBC application developers do not need to concern themselves with the low-level details of clients, connections, and proof verification. Nevertheless, an overview of these low-level concepts can be found in [the Overview section](../overview.md). |
| 12 | +The document goes into detail on the abstraction layer most relevant for application developers (channels and ports), and describes how to define your own custom packets, `IBCModule` callbacks and more to make an application module IBC ready. |
| 13 | + |
| 14 | +**To have your module interact over IBC you must:** |
| 15 | + |
| 16 | +- implement the `IBCModule` interface, i.e.: |
| 17 | + - channel (opening) handshake callbacks |
| 18 | + - channel closing handshake callbacks |
| 19 | + - packet callbacks |
| 20 | +- bind to a port(s) |
| 21 | +- add keeper methods |
| 22 | +- define your own packet data and acknowledgement structs as well as how to encode/decode them |
| 23 | +- add a route to the IBC router |
| 24 | + |
| 25 | +The following sections provide a more detailed explanation of how to write an IBC application |
| 26 | +module correctly corresponding to the listed steps. |
| 27 | + |
| 28 | +## Pre-requisites Readings |
| 29 | + |
| 30 | +- [IBC Overview](../overview.md)) {prereq} |
| 31 | +- [IBC default integration](../integration.md) {prereq} |
| 32 | + |
| 33 | +## Working example |
| 34 | + |
| 35 | +For a real working example of an IBC application, you can look through the `ibc-transfer` module |
| 36 | +which implements everything discussed in this section. |
| 37 | + |
| 38 | +Here are the useful parts of the module to look at: |
| 39 | + |
| 40 | +[Binding to transfer |
| 41 | +port](https://github.com/cosmos/ibc-go/blob/main/modules/apps/transfer/keeper/genesis.go) |
| 42 | + |
| 43 | +[Sending transfer |
| 44 | +packets](https://github.com/cosmos/ibc-go/blob/main/modules/apps/transfer/keeper/relay.go) |
| 45 | + |
| 46 | +[Implementing IBC |
| 47 | +callbacks](https://github.com/cosmos/ibc-go/blob/main/modules/apps/transfer/ibc_module.go) |
| 48 | + |
| 49 | +## Next {hide} |
| 50 | + |
| 51 | +Learn about [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules/01-intro.md) {hide} |
0 commit comments