Bank User Guide

Introduction

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

Usage Scenario

  1. Query the coin_type configuration of a certain token:

    iriscli bank coin-type <coin-name>
    

    example:

    iriscli bank coin-type iris
    

    Refer to Query of coin_type for details.

  2. Query account

    Query the account information of a certain account address, including the balance, the public key, the account number and the transaction sequence.

    iriscli bank account <account_address>
    
  3. Transfer between accounts

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

    iriscli bank send --to=<address_of_wallet_B> --amount=10iris --fee=0.3iris --from=<key_name_of_wallet_A> --chain-id=<chain-id>
    

    IRISnet supports multiple tokens in circulation, and in the future IRISnet will be able to include multiple tokens in one transaction -- tokens can be any coin_type registered in IRISnet.

  4. Sign transactions generated offline

    To improve account security, IRISnet 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:

    iriscli bank send --to=<address_of_wallet_B> --amount=10iris --fee=0.3iris --from=<key_name_of_wallet_A> --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.

    Send signature transaction:

    iriscli bank sign <file> --chain-id=<chain-id>  --name=<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.

  5. Broadcast transactions

    Broadcast offline signed transactions. Here you can just use the transaction generated by above sign command. Of course, you can generate your signed transaction by any methods, eg. irisnet-crypto.

    iriscli bank broadcast <file>
    

    The transaction will be broadcast and executed in IRISnet.