Bank

Summary

This module is mainly used to transfer coins between accounts, query account balances, and provide common offline transaction signing and broadcasting methods. In addition, the available units of tokens in the IRIShub system are defined using coin-type.

Usage Scenario

  1. Query the balances of an account

    Query the total balance of an account or of a specific denomination.

    iris query bank balances [address] --denom=[denom]
    
  2. Transfer between accounts

    For example, transfer 10iris from account A to account B:

    iris tx bank send [A] [B] [10iris] --fees=0.3iris --chain-id=irishub
    

    IRIShub supports multiple tokens in circulation, and in the future IRIShub will be able to include multiple tokens in one transaction.

  3. Sign transactions generated offline

    To improve account security, IRIShub supports offline signing of transactions to protect the account's private key. In any transaction, you can build an unsigned transaction using the flag --generate-only. Take transfer transaction as an example:

    iris tx bank send [from_key_or_address] [to_address] [amount]  --fees=0.3iris --generate-only
    

    Return the built transaction with empty signatures:

    {
        "type": "auth/StdTx",
        "value": {
            "msg": [ "txMsg" ],
            "fee": "fee",
            "signatures": null,
            "memo": ""
        }
    }
    

    Save the result to a file.

    Sign the transaction:

    iris tx sign <file> --chain-id=irishub --from=<key-name>
    

    Return signed transactions:

    {
        "type": "auth/StdTx",
        "value": {
            "msg": [ "txMsg" ],
            "fee": "fee",
            "signatures": [
            {
                "pub_key": {
                "type": "tendermint/PubKeySecp256k1",
                "value": "A+qXW5isQDb7blT/KwEgQHepji8RfpzIstkHpKoZq0kr"
                },
                "signature": "5hxk/R81SWmKAGi4kTW2OapezQZpp6zEnaJbVcyDiWRfgBm4Uejq8+CDk6uzk0aFSgAZzz06E014UkgGpelU7w==",
                "account_number": "0",
                "sequence": "11"
            }
            ],
            "memo": ""
        }
    }
    

    Save the result to a file.

  4. Broadcast transactions

    Broadcast offline signed transactions. Here you can just use the transaction generated by the above signing command. Of course, you can generate your signed transaction by any methods, eg. irisnet-cryptoopen in new window.

    iris tx broadcast <file>
    

    The transaction will be broadcast and executed in IRIShub.