Skip to content

Commit

Permalink
IRISHUB-677: en user guide for bank
Browse files Browse the repository at this point in the history
  • Loading branch information
chengwenxi committed Nov 18, 2018
1 parent 5c782c8 commit bd1b782
Show file tree
Hide file tree
Showing 2 changed files with 201 additions and 4 deletions.
197 changes: 197 additions & 0 deletions docs/features/bank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
# Bank User Guide

## Introduction
This module is mainly used to transfer coins between accountsquery 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](./basic-concepts/coin-type.md).

## Usage Scenario

1. Query the coin_type configuration of a certain token
```bash
iriscli bank coin-type [coin-name]
```
For example, coin_type of iris will be returned if the coin-name is iris:
```json
{
"name": "iris",
"min_unit": {
"denom": "iris-atto",
"decimal": "18"
},
"units": [
{
"denom": "iris",
"decimal": "0"
},
{
"denom": "iris-milli",
"decimal": "3"
},
{
"denom": "iris-micro",
"decimal": "6"
},
{
"denom": "iris-nano",
"decimal": "9"
},
{
"denom": "iris-pico",
"decimal": "12"
},
{
"denom": "iris-femto",
"decimal": "15"
},
{
"denom": "iris-atto",
"decimal": "18"
}
],
"origin": 1,
"desc": "IRIS Network"
}
```
2. Query account
Query the account information of a certain account address, including the balance, the public key, the account number and the transaction number.
```bash
iriscli bank account [account address]
```
3. Transfer between accounts
For example, transfer from account A to account B10iris:
```bash
iriscli bank send --to [address of wallet B] --amount=10iris --fee=0.004iris --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=true. Use transfer transactions as an example:
```bash
iriscli bank send --to [address of wallet B] --amount=10iris --fee=0.004iris --from=[key name of wallet A] --generate-only=true
```
Return the built transaction with empty signatures:
```json
{
"type": "auth/StdTx",
"value": {
"msg": [
{
"type": "cosmos-sdk/Send",
"value": {
"inputs": [
{
"address": "faa1ydhmma8l4m9dygsh7l08fgrwka6yczs0gkfnvd",
"coins": [
{
"denom": "iris-atto",
"amount": "100000000000000000000"
}
]
}
],
"outputs": [
{
"address": "faa1ut8aues05kq0nkcj3lzkyhk7eyfasrdfnf7wph",
"coins": [
{
"denom": "iris-atto",
"amount": "100000000000000000000"
}
]
}
]
}
}
],
"fee": {
"amount": [
{
"denom": "iris-atto",
"amount": "40000000000000000"
}
],
"gas": "200000"
},
"signatures": null,
"memo": ""
}
}
```
Save the result to a file.

Send signature transaction:
```bash
iriscli bank sign [file] --chain-id=[chain-id] --name [key name of from account]
```
Return signed transactions:
```json
{
"type": "auth/StdTx",
"value": {
"msg": [
{
"type": "cosmos-sdk/Send",
"value": {
"inputs": [
{
"address": "faa1ydhmma8l4m9dygsh7l08fgrwka6yczs0gkfnvd",
"coins": [
{
"denom": "iris-atto",
"amount": "100000000000000000000"
}
]
}
],
"outputs": [
{
"address": "faa1ut8aues05kq0nkcj3lzkyhk7eyfasrdfnf7wph",
"coins": [
{
"denom": "iris-atto",
"amount": "100000000000000000000"
}
]
}
]
}
}
],
"fee": {
"amount": [
{
"denom": "iris-atto",
"amount": "40000000000000000"
}
],
"gas": "200000"
},
"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 signed transactions generated offline, using the final generated file in step 4:
```bash
iriscli bank broadcast [file]
```
The transaction will broadcast and executed in IRISnet.

8 changes: 4 additions & 4 deletions docs/zh/features/bank.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Bank模块用户文档

## 简介
该模块主要用于账户之间转账查询账户余额同时提供了通用的签名方法此外irisnet使用[coin_type](./basic-concepts/coin-type.md)定义了iris-hub系统中代币的可用单位
该模块主要用于账户之间转账查询账户余额同时提供了通用的离线签名与交易广播方法此外使用[coin_type](./basic-concepts/coin-type.md)定义了IRIShub系统中代币的可用单位

## 使用场景

Expand Down Expand Up @@ -65,11 +65,11 @@
```bash
iriscli bank send --to [address of wallet B] --amount=10iris --fee=0.004iris --from=[key name of wallet A] --chain-id=[chain-id]
```
iris网络支持多种代币流通,在将来iris可以在同一交易个包含多种代币交换——代币种类可以为任意在iris网络中注册过的coin_type
IRISnet支持多种代币流通,将来IRISnet可以在一个交易中包含多种代币交换——代币种类可以为任意在IRISnet中注册过的coin_type
4. 交易签名
为了提高账户安全性,iris提供离线签名保护账户的私钥。在任意交易中,使用参数--generate-only=true可以构建一个未签名的交易。使用转账交易作为示例:
为了提高账户安全性,IRISnet支持交易离线签名保护账户的私钥。在任意交易中,使用参数--generate-only=true可以构建一个未签名的交易。使用转账交易作为示例:
```bash
iriscli bank send --to [address of wallet B] --amount=10iris --fee=0.004iris --from=[key name of wallet A] --generate-only=true
```
Expand Down Expand Up @@ -193,5 +193,5 @@
```bash
iriscli bank broadcast [file]
```
该交易将在iris网络中广播并执行
该交易将在IRISnet中广播并执行

0 comments on commit bd1b782

Please sign in to comment.