Skip to main content
logo

bank

The bank module is responsible for handling token transfer functionalities such as multi-asset coin transfers between accounts and tracking special-case pseudo-transfers which must work differently with particular kinds of accounts (notably delegating/undelegating for vesting accounts). It exposes several interfaces with varying capabilities for secure interaction with other modules which must alter user balances.

In addition, the bank module tracks and provides query support for the total supply of all assets used in the application.

For more information, visit https://docs.cosmos.network/main/modules/bank/

Message Types

Msg defines the bank Msg service.

tx.proto
Copy

_7
service Msg {
_7
// Send defines a method for sending coins from one account to another account.
_7
rpc Send(MsgSend) returns (MsgSendResponse);
_7
_7
// MultiSend defines a method for sending coins from some accounts to other accounts.
_7
rpc MultiSend(MsgMultiSend) returns (MsgMultiSendResponse);
_7
}

MsgSend

MsgSend represents a message to send coins from one account to another.

tx.proto
Copy

_11
message MsgSend {
_11
option (cosmos.msg.v1.signer) = "from_address";
_11
_11
option (gogoproto.equal) = false;
_11
option (gogoproto.goproto_getters) = false;
_11
_11
string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_11
string to_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_11
repeated cosmos.base.v1beta1.Coin amount = 3
_11
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
_11
}

MsgSendResponse

MsgSendResponse defines the Msg/Send response type.

tx.proto
Copy

_1
message MsgSendResponse {}

MsgMultiSend

MsgMultiSend represents an arbitrary multi-in, multi-out send message.

tx.proto
Copy

_8
message MsgMultiSend {
_8
option (cosmos.msg.v1.signer) = "inputs";
_8
_8
option (gogoproto.equal) = false;
_8
_8
repeated Input inputs = 1 [(gogoproto.nullable) = false];
_8
repeated Output outputs = 2 [(gogoproto.nullable) = false];
_8
}

MsgMultiSendResponse

MsgMultiSendResponse defines the Msg/MultiSend response type.

tx.proto
Copy

_1
message MsgMultiSendResponse {}

Queries

Query defines the gRPC querier service.

query.proto
Copy

_49
service Query {
_49
// Balance queries the balance of a single coin for a single account.
_49
rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) {
_49
option (google.api.http).get = "/cosmos/bank/v1beta1/balances/{address}/by_denom";
_49
}
_49
_49
// AllBalances queries the balance of all coins for a single account.
_49
rpc AllBalances(QueryAllBalancesRequest) returns (QueryAllBalancesResponse) {
_49
option (google.api.http).get = "/cosmos/bank/v1beta1/balances/{address}";
_49
}
_49
_49
// SpendableBalances queries the spenable balance of all coins for a single
_49
// account.
_49
rpc SpendableBalances(QuerySpendableBalancesRequest) returns (QuerySpendableBalancesResponse) {
_49
option (google.api.http).get = "/cosmos/bank/v1beta1/spendable_balances/{address}";
_49
}
_49
_49
// TotalSupply queries the total supply of all coins.
_49
rpc TotalSupply(QueryTotalSupplyRequest) returns (QueryTotalSupplyResponse) {
_49
option (google.api.http).get = "/cosmos/bank/v1beta1/supply";
_49
}
_49
_49
// SupplyOf queries the supply of a single coin.
_49
rpc SupplyOf(QuerySupplyOfRequest) returns (QuerySupplyOfResponse) {
_49
option (google.api.http).get = "/cosmos/bank/v1beta1/supply/by_denom";
_49
}
_49
_49
// Params queries the parameters of x/bank module.
_49
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
_49
option (google.api.http).get = "/cosmos/bank/v1beta1/params";
_49
}
_49
_49
// DenomsMetadata queries the client metadata of a given coin denomination.
_49
rpc DenomMetadata(QueryDenomMetadataRequest) returns (QueryDenomMetadataResponse) {
_49
option (google.api.http).get = "/cosmos/bank/v1beta1/denoms_metadata/{denom}";
_49
}
_49
_49
// DenomsMetadata queries the client metadata for all registered coin
_49
// denominations.
_49
rpc DenomsMetadata(QueryDenomsMetadataRequest) returns (QueryDenomsMetadataResponse) {
_49
option (google.api.http).get = "/cosmos/bank/v1beta1/denoms_metadata";
_49
}
_49
_49
// DenomOwners queries for all account addresses that own a particular token
_49
// denomination.
_49
rpc DenomOwners(QueryDenomOwnersRequest) returns (QueryDenomOwnersResponse) {
_49
option (google.api.http).get = "/cosmos/bank/v1beta1/denom_owners/{denom}";
_49
}
_49
}

QueryBalanceRequest

QueryBalanceRequest is the request type for the Query/Balance RPC method.

query.proto
Copy

_10
message QueryBalanceRequest {
_10
option (gogoproto.equal) = false;
_10
option (gogoproto.goproto_getters) = false;
_10
_10
// address is the address to query balances for.
_10
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_10
_10
// denom is the coin denom to query balances for.
_10
string denom = 2;
_10
}

QueryBalanceResponse

QueryBalanceResponse is the response type for the Query/Balance RPC method.

query.proto
Copy

_4
message QueryBalanceResponse {
_4
// balance is the balance of the coin.
_4
cosmos.base.v1beta1.Coin balance = 1;
_4
}

QueryAllBalanceRequest

QueryAllBalanceRequest is the request type for the Query/AllBalances RPC method.

query.proto
Copy

_10
message QueryAllBalancesRequest {
_10
option (gogoproto.equal) = false;
_10
option (gogoproto.goproto_getters) = false;
_10
_10
// address is the address to query balances for.
_10
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_10
_10
// pagination defines an optional pagination for the request.
_10
cosmos.base.query.v1beta1.PageRequest pagination = 2;
_10
}

QueryAllBalancesResponse

QueryAllBalancesResponse is the response type for the Query/AllBalances RPC method.

query.proto
Copy

_8
message QueryAllBalancesResponse {
_8
// balances is the balances of all the coins.
_8
repeated cosmos.base.v1beta1.Coin balances = 1
_8
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
_8
_8
// pagination defines the pagination in the response.
_8
cosmos.base.query.v1beta1.PageResponse pagination = 2;
_8
}

QuerySpendableBalancesRequest

QuerySpendableBalancesRequest defines the gRPC request structure for querying an account's spendable balances.

query.proto
Copy

_10
message QuerySpendableBalancesRequest {
_10
option (gogoproto.equal) = false;
_10
option (gogoproto.goproto_getters) = false;
_10
_10
// address is the address to query spendable balances for.
_10
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_10
_10
// pagination defines an optional pagination for the request.
_10
cosmos.base.query.v1beta1.PageRequest pagination = 2;
_10
}

QuerySpendableBalancesResponse

QuerySpendableBalancesResponse defines the gRPC response structure for querying an account's spendable balances.

query.proto
Copy

_8
message QuerySpendableBalancesResponse {
_8
// balances is the spendable balances of all the coins.
_8
repeated cosmos.base.v1beta1.Coin balances = 1
_8
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
_8
_8
// pagination defines the pagination in the response.
_8
cosmos.base.query.v1beta1.PageResponse pagination = 2;
_8
}

QueryTotalSupplyRequest

QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC method.

query.proto
Copy

_9
message QueryTotalSupplyRequest {
_9
option (gogoproto.equal) = false;
_9
option (gogoproto.goproto_getters) = false;
_9
_9
// pagination defines an optional pagination for the request.
_9
//
_9
// Since: cosmos-sdk 0.43
_9
cosmos.base.query.v1beta1.PageRequest pagination = 1;
_9
}

QueryTotalSupplyResponse

QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC method.

query.proto
Copy

_10
message QueryTotalSupplyResponse {
_10
// supply is the supply of the coins
_10
repeated cosmos.base.v1beta1.Coin supply = 1
_10
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
_10
_10
// pagination defines the pagination in the response.
_10
//
_10
// Since: cosmos-sdk 0.43
_10
cosmos.base.query.v1beta1.PageResponse pagination = 2;
_10
}

QuerySupplyOfRequest

QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method.

query.proto
Copy

_4
message QuerySupplyOfRequest {
_4
// denom is the coin denom to query balances for.
_4
string denom = 1;
_4
}

QuerySupplyOfResponse

QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method.

query.proto
Copy

_4
message QuerySupplyOfResponse {
_4
// amount is the supply of the coin.
_4
cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false];
_4
}

QueryParamsRequest

QueryParamsRequest defines the request type for querying x/bank parameters.

query.proto
Copy

_1
message QueryParamsRequest {}

QueryParamsResponse

QueryParamsResponse defines the response type for querying x/bank parameters.

query.proto
Copy

_3
message QueryParamsResponse {
_3
Params params = 1 [(gogoproto.nullable) = false];
_3
}

QueryDenomMetadataRequest

QueryDenomMetadataRequest is the request type for the Query/DenomMetadata RPC method.

query.proto
Copy

_4
message QueryDenomMetadataRequest {
_4
// denom is the coin denom to query the metadata for.
_4
string denom = 1;
_4
}

QueryDenomMetadataResponse

QueryDenomMetadataResponse is the response type for the Query/DenomMetadata RPC method.

query.proto
Copy

_4
message QueryDenomMetadataResponse {
_4
// metadata describes and provides all the client information for the requested token.
_4
Metadata metadata = 1 [(gogoproto.nullable) = false];
_4
}

QueryDenomsMetadataRequest

QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method.

query.proto
Copy

_4
message QueryDenomsMetadataRequest {
_4
// pagination defines an optional pagination for the request.
_4
cosmos.base.query.v1beta1.PageRequest pagination = 1;
_4
}

QueryDenomsMetadataResponse

QueryDenomsMetadataResponse is the response type for the Query/DenomsMetadata RPC method.

query.proto
Copy

_7
message QueryDenomsMetadataResponse {
_7
// metadata provides the client information for all the registered tokens.
_7
repeated Metadata metadatas = 1 [(gogoproto.nullable) = false];
_7
_7
// pagination defines the pagination in the response.
_7
cosmos.base.query.v1beta1.PageResponse pagination = 2;
_7
}

QueryDenomOwnersRequest

QueryDenomOwnersRequest defines the request type for the DenomOwners RPC query, which queries for a paginated set of all account holders of a particular denomination.

query.proto
Copy

_7
message QueryDenomOwnersRequest {
_7
// denom defines the coin denomination to query all account holders for.
_7
string denom = 1;
_7
_7
// pagination defines an optional pagination for the request.
_7
cosmos.base.query.v1beta1.PageRequest pagination = 2;
_7
}

QueryDenomOwnersResponse

QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query.

query.proto
Copy

_6
message QueryDenomOwnersResponse {
_6
repeated DenomOwner denom_owners = 1;
_6
_6
// pagination defines the pagination in the response.
_6
cosmos.base.query.v1beta1.PageResponse pagination = 2;
_6
}