Cosmos SDK Msgs

What are Cosmos SDK Msgs? Msgs vs Transactions?

In Cosmos SDK, Msgs are messages that represent actions to be executed on the blockchain, such as sending tokens.

Each transaction must consist of one or Msgs to be executed. Transactions also consist of other accompanying details such as the signature info.

What Msgs does the BitBadges blockchain implement?

The BitBadges blockchain utilizes various pre-written modules from the Cosmos SDK (auth, authz, genutil, bank, capability, staking, distr, gov, params, crisis, slashing, feegrant, group, wasm, ibc, upgrade, evidence, transfer, ica, vesting). The documentation for the pre-written modules can be found here.

The x/badges module is the core functionality of BitBadges written by us, and within this module, all the Msg types that correspond to badges are defined. We also use an x/wasmx module which helps to create compatible smart contracts (forked from Injective). The x/maps allows storing data in a structured format with many customization options for the map. The x/anchor alllows for storing unstructured data.

How to broadcast transactions with Msgs?

You can generate and submit your transactions (Msgs) via:

What is the creator field?

The creator field for each message should be the transaction signer's cosmos address.

Msg Definitions

Below, we link the documentation for the Msgs from our x/badges and x/wasmx module.

x/badges

  • MsgCreateCollection - Creates a new collection. For creation transactions, everything is considered "free" (no permission restrictions). For following update transactions, everything must follow the permissions set.

  • MsgUpdateCollection - Updates the details of a collection. Must be manager of the corresponding collection to execute and all updates must follow the permissions set.

  • MsgUniversalUpdateCollection - This is a universal all-in-one message that supports everything from both MsgCreateCollection and MsgUpdateCollection. If collectionId == 0, we treat it as a create transaction. If collectionId > 0, we update the corresponding collection.

    • Mainly used for legacy purposes. To avoid confusion, we recommend using MsgCreate or MsgUpdate because those will be typed correctly for your use case.

  • MsgTransferBadges - Transfer badges between users, if approvals allow.

  • MsgUpdateUserApprovals - Set incoming / outgoing approvals for a collection, in addition to permissions which define the updatability of the approvals.

  • MsgDeleteCollection - Deletes the collection, if permissions allow. Must be manager.

  • MsgCreateAddressLists - Creates address list(s).

x/wasmx

x/maps

  • MsgCreateMap - Creates a map, uniquely identifed by an ID

  • MsgUpdateMap - Updates an existing map.

  • MsgDeleteMap - Deletes a map

  • MsgSetValue - Allows a user to specify a (key, value) pair if permissions allow.

x/anchor

  • MsgAddCustomData - Add custom data to the blockchain. No structure to the data at all (just a string). Will return a location for where to find your data.

Other Cosmos SDK Modules

For other standard Cosmos SDK messages, you can check out the bitbadges SDK documentation (such as MsgSend here). Or, check the official Cosmos documentation as these were written by them!

Last updated