Bank
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.
_6// MsgSend - high level transaction of the coin module_6type MsgSend struct {_6 FromAddress sdk.AccAddress `json:"from_address"`_6 ToAddress sdk.AccAddress `json:"to_address"`_6 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
_15// MsgMultiSend - high level transaction of the coin module_15type Input struct {_15 Address sdk.AccAddress `json:"address" yaml:"address"`_15 Coins sdk.Coins `json:"coins" yaml:"coins"`_15}_15_15type Output struct {_15 Address sdk.AccAddress `json:"address" yaml:"address"`_15 Coins sdk.Coins `json:"coins" yaml:"coins"`_15}_15_15type MsgMultiSend struct {_15 Inputs []Input `json:"inputs" yaml:"inputs"`_15 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
The genesis parameters outlined in the Genesis Builder Script are as follows:
_20_20 # Bank: setup supply_20 genesis['app_state']['bank']['supply'] = [{_20 'denom': DENOM_LUNA,_20 'amount': str(TOTAL_ALLOCATION),_20 }]_20_20 # Bank: set denom meta_20 genesis['app_state']['bank']['denom_metadata'] = [{_20 'description': 'The native staking token of Terra',_20 'denom_units': [_20 {'denom': 'uluna', 'exponent': 0, 'aliases': ['microluna']},_20 {'denom': 'mluna', 'exponent': 3, 'aliases': ['milliluna']},_20 {'denom': 'luna', 'exponent': 6, 'aliases': []},_20 ],_20 'base': 'uluna',_20 'display': 'luna',_20 'name': 'LUNA',_20 'symbol': 'LUNA',_20 }]