Integrating Connect with Blockchain Applications
Add Oracle Configuration
Add Modules
x/marketmap
and x/oracle
Modules to your app.Setup Oracle Client
Set ABCI Method
Configure Vote Extensions
app.toml
.
The application should contain a custom configuration struct with a "github.com/cosmos/cosmos-sdk/server/config"
embedded.
Note: application function and type names may vary. The names in the following steps are arbitrary for example purposes only.
server.InterceptConfigsPreRunHandler
in the application’s root command.
Example:
appBuilder
, finish the initialization of the MarketMapKeeper
by setting the hooks.
PrepareProposal
and ProcessProposal
to fill proposals with the oracle data.PreBlocker
will be configured to write price data to state before transactions are executed.PreBlocker
. This involves:
DeltaCurrencyPairStrategy
which encodes/decodes the price as the difference between the current price and the previous price. While other strategies are available, we recommend this one for most applications.app.go
, directly after setting the x/marketmap
hooks.
x/marketmap
with initial marketsInitChainer
. Connect will begin posting prices to the chain once the VoteExtensionsEnabledHeight
is reached.