Account Balance
Abstract
The bank module is responsible for handling BNB transfers between accounts and module accounts.
In addition, the bank module tracks and provides query support for the total supply of BNB in the application.
Quick Start
Query Balances
To query the balances of an account, you can use the following command.
gnfd q bank balances ${receiver} --node ${node}
You can specify any valid address you want to query via ${receiver}.
${node} is the rpc address of a Greenfield node.
- Mainnet
- Testnet
node = "https://greenfield-chain.bnbchain.org:443"
node = "https://gnfd-testnet-fullnode-tendermint-us.bnbchain.org:443"
Send
To transfer some coins you can use send
command.
gnfd tx bank send ${key} ${receiver} ${coins} --home ~/.gnfd --node ${node} -y
${key} is the name of local key.
${coins} defines the coins you want to transfer, for example, 500000000000000000000BNB
.
Multi-send
Sometimes, you may want to transfer tokens to multiple people. multi-send
command can be used for the purpose.
gnfd tx bank multi-send ${key} ${receiver1} ${receiver2} ${coins} --home ~/.gnfd --node ${node} -y
Detailed CLI
A user can query and interact with the bank
module using the CLI.
Query
The query
commands allow users to query bank
state.
gnfd query bank --help
balances
The balances
command allows users to query account balances by address.
gnfd query bank balances [address] [flags]
Example:
gnfd query bank balances 0x73a4Cf67b46D7E4efbb95Fc6F59D64129299c2E3
Example Output:
balances:
- amount: "10000000000000000000000"
denom: BNB
pagination:
next_key: null
total: "0"
denom-metadata
The denom-metadata
command allows users to query metadata for coin denominations. A user can query metadata for a single denomination using the --denom
flag or all denominations without it.
gnfd query bank denom-metadata [flags]
Example:
gnfd query bank denom-metadata --denom BNB
Example Output:
metadata:
base: BNB
denom_units:
- aliases:
- wei
denom: BNB
exponent: 0
description: The native staking token of the Greenfield.
display: BNB
name: ""
symbol: ""
uri: ""
uri_hash: ""
total
The total
command allows users to query the total supply of coins. A user can query the total supply for a single coin using the --denom
flag or all coins without it.
gnfd query bank total [flags]
Example:
gnfd query bank total --denom BNB
Example Output:
amount: "1000000000000000800000000000"
denom: BNB
Transactions
The tx
commands allow users to interact with the bank
module.
gnfd tx bank --help
send
The send
command allows users to send funds from one account to another.
gnfd tx bank send [from_key_or_address] [to_address] [amount] [flags]
Example:
gnfd tx bank send addr1.. addr2.. 100000000000000000000BNB