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.Connecting your wallet
You can connect your wallet using a mnemonic or a private key as shown below.Getting your address
You can get your address using thegetAddress method.
Preparing a transaction
You can prepare a transaction using thepreparePay method.
Preparing multiple transactions
You can prepare multiple transactions using thepreparePays method.
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:| Property | Type | Description |
|---|---|---|
instance.provider | StargateClient | Provides read-only access to blockchain data |
instance.wallet | SigningStargateClient | Allows for signing and broadcasting transactions |
instance.signer | DirectSecp256k1Wallet or DirectSecp256k1HdWallet | Manages the private key and signing operations |
Example
To get the latest block, you can use thegetBlock method.