Skip to main content

IBC

Inter-Blockchain Communication Protocol (IBC) is a blockchain interoperability protocol used by 110+ chains. It enables secure, permissionless, feature-rich cross-chain interactions.

Creating the SDK instance

I’ll be using the Stargaze testnet for the examples.
The instance is now connected to the Stargaze testnet and ready to be used.

Connecting your wallet

You can connect your wallet using a mnemonic or a private key as shown below.
When connecting your wallet, you also need to specify the address prefix for your chain and the gas price to be used when creating transactions.

Getting your address

You can get your address using the getAddress method.

Preparing a transaction

You can prepare a transaction using the preparePay method.
When creating a transaction, you need to specify the recipient address, the amount to be transferred, and the token denomination.

Preparing multiple transactions

You can prepare multiple transactions using the preparePays method.
The preparePays method returns an array of signed transactions ready to be sent to a DEMOS node. The transactions are signed with an incrementing nonce derived from the ledger sequence.

Signing Messages

Verifying signature

Cleaning up

When you’re done with the SDK instance, you can disconnect your wallet and RPC connection.

Hacking

The DEMOS IBC SDK is built on top of the CosmJS library, and only provides a limited set of methods to interact with the blockchain. You can access the underlying CosmJS objects to have more control over the transactions and interactions with the blockchain. Here is a list of the objects you can access:

Example

To get the latest block, you can use the getBlock method.

API Reference

https://kynesyslabs.github.io/demosdk-api-ref/classes/xmwebsdk.IBC.html