Search
Duplicate
Try Notion
🚧🚧
Transfers & balances
Concept
Terra's bank module inherits from the Cosmos SDK's bank module. This document is a stub and mainly covers important Terra-specific notes on how it is used.
The bank module is the base transactional layer of the Terra blockchain. This module allows assets to be sent from one Account to another. The bank module defines the following types of send transactions: MsgSend and MsgMultiSend.
Message types
MsgSend
MsgSend transfers funds from a source account to a destination account.
1// MsgSend - high level transaction of the coin module2type MsgSend struct {3 FromAddress sdk.AccAddress `json:"from_address"`4 ToAddress sdk.AccAddress `json:"to_address"`5 Amount sdk.Coins `json:"amount"`6}
The Bank module is used to send coins from one Terra account to another. MsgSend is constructed to facilitate the transfer. If the balance of coins in the sender Account is insufficient or the recipient Account is unable to receive the funds via the bank module, the transaction fails. Fees already paid through failed transactions are not refunded.
MsgMultiSend
1// MsgMultiSend - high level transaction of the coin module2type Input struct {3 Address sdk.AccAddress `json:"address" yaml:"address"`4 Coins sdk.Coins `json:"coins" yaml:"coins"`5}67type Output struct {8 Address sdk.AccAddress `json:"address" yaml:"address"`9 Coins sdk.Coins `json:"coins" yaml:"coins"`10}1112type MsgMultiSend struct {13 Inputs []Input `json:"inputs" yaml:"inputs"`14 Outputs []Output `json:"outputs" yaml:"outputs"`15}
To send multiple transactions at once, use MsgMultiSend. For each transaction, Inputs contains the incoming transactions, and Outputs contains the outgoing transactions. The Inputs coin balance must match the Outputs coin balance exactly. Batching transactions via MsgMultiSend conserves gas fees and network bandwidth. Fees already paid through failed transactions are not refunded.
Parameters
CLI functions description
x/x
query/x
Syntax & examples
📌
Each CLI command and proposal process in KIRA requires specific permissions. These permissions must be added to the account's whitelist or obtained as sudo permissions for direct changes. Refer to the Roles & Permissions documentation for more details. $SIGNER represents the transaction signer's account name or address. For instructions on setting common flags as environment variables, such as $FLAGS_TX and $FLAGS_QR, see the CLI flags configuration section
XXX
Queries
XXX
Transfering Tokens
Bash
Copy
# CLI sekaid tx bank send $ACCOUNT $DESTINATION "${AMOUNT}${DENOM}" --keyring-backend=test --home=$SEKAID_HOME --chain-id=$NETWORK_NAME --fees "${FEE_AMOUNT}${FEE_DENOM}" --output=json --yes # KM # e.g: sendTokens <source-account> <destination-account/address> <amount> <denom> <fee-amount> <fee-denom> sendTokens validator test 1 ukex sendTokens validator "kiraXXX...XXX" 1 ukex sendTokens validator test 1 ukex 50 lol
​
Query Token Balances
Bash
Copy
# CLI sekaid query bank balances "$ADDR" --output=json --home=$SEKAID_HOME | jq # KM # e.g: showBalance <account/address> showBalance validator showBalance "kiraXXX...XXX"
​
Query Transactions
Bash
Copy
# CLI sekaid query tx "$TX_HASH" --output=json --home=$SEKAID_HOME | jq # KM # e.g: txQuery <hash> txQuery "YYY...YYY"
​