Cosmos SDK Msgs
Last updated
Last updated
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 .
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:
: Generate and broadcast transactions to a running node with TypeScript. See . This is the recommended option.
CLI: Run your own node and interact with the command line
Other:
What is the creator field?
The creator field for each message should be the transaction signer's BitBadges address.
Below, we link the documentation for the Msgs from our x/badges and x/wasmx module.
x/badges
Mainly used for legacy purposes. To avoid confusion, we recommend using MsgCreate or MsgUpdate because those will be typed correctly for your use case.
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
- Creates a new collection. For creation transactions, everything is considered "free" (no permission restrictions). For following update transactions, everything must follow the permissions set.
- Updates the details of a collection. Must be manager of the corresponding collection to execute and all updates must follow the permissions set.
- 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.
- Transfer badges between users, if approvals allow.
- Set incoming / outgoing approvals for a collection, in addition to permissions which define the updatability of the approvals.
- Deletes the collection, if permissions allow. Must be manager.
- Creates address list(s).
- Helper Msg to support executing contracts from Ethereum wallets for EIP712. See for tutorial.
For other standard Cosmos SDK messages, you can check out the bitbadges SDK documentation (such as here). Or, check the official Cosmos documentation as these were written by them!