OSDN Git Service

Merge branch 'dev' into dev-verify
[bytom/bytom.git] / README.md
index 9ec7ff5..d9926b1 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 Bytom
 =====
-
+[![Build Status](https://travis-ci.org/Bytom/bytom.svg)](https://travis-ci.org/Bytom/bytom)
 [![AGPL v3](https://img.shields.io/badge/license-AGPL%20v3-brightgreen.svg)](./LICENSE)
 
 ## Table of Contents
@@ -13,10 +13,24 @@ Bytom
     * [Get the source code](#get-the-source-code)
     * [Build](#build)
 * [Example](#example)
-  * [Set up a wallet and manage the key](#set-up-a-wallet-and-manage-the-key)
-  * [Create and launch a single node](#create-and-launch-a-single-node)
-    * [Asset issuance test](#asset-issuance-test)
-  * [Multiple node](#multiple-node)
+  * [Initialize](#initialize)
+  * [launch](#launch)
+    * [Dashboard](#dashboard)
+  * [Create key](#create-key)
+  * [Create account](#create-account)
+    * [Multi-signature account](#multi-signature-account)
+  * [Create asset](#create-asset)
+    * [Multi-signature asset](#multi-signature-asset)
+  * [Sending transaction](#sending-transaction)
+    * [Issue](#issue)
+      * [`build-transaction`](#build-transaction)
+      * [`sign-submit-transaction`](#sign-submit-transaction)
+    * [Spend](#spend)
+      * [`create-account-receiver`](#create-account-receiver)
+      * [`build-transaction`](#build-transaction-1)
+      * [`sign-submit-transaction`](#sign-submit-transaction-1)
+    * [Transfer BTM](#transfer-btm)
+* [Running Bytom in Docker](#running-bytom-in-docker)
 * [Contributing](#contributing)
 * [License](#license)
 
@@ -28,8 +42,8 @@ Bytom is software designed to operate and connect to highly scalable blockchain
 
 In the current state `bytom` is able to:
 
-- Issue assets
-- Manage account as well as asset
+- Manage key, account as well as asset
+- Send transactions, i.e., issue, spend and retire asset
 
 ## Build from source
 
@@ -54,153 +68,417 @@ $ git clone https://github.com/Bytom/bytom $GOPATH/src/github.com/bytom
 
 #### Build
 
-- Bytom
-
 ``` bash
 $ cd $GOPATH/src/github.com/bytom
-$ make install
-$ cd ./cmd/bytom
-$ go build
+$ make bytomd    # build bytomd
+$ make bytomcli  # build bytomcli
 ```
 
-- Bytomcli
+When successfully building the project, the `bytom` and `bytomcli` binary should be present in `cmd/bytomd` and `cmd/bytomcli` directory, respectively.
+
+## Example
+
+Currently, bytom is still in active development and a ton of work needs to be done, but we also provide the following content for these eager to do something with `bytom`. This section won't cover all the commands of `bytomd` and `bytomcli` at length, for more information, please the help of every command, e.g., `bytomcli help`.
+
+### Initialize
+
+First of all, initialize the node:
 
-```go
-$ cd $GOPATH/src/github.com/bytom/cmd/bytomcli
-$ go build
+```bash
+$ cd ./cmd/bytomd
+$ ./bytomd init --chain_id testnet
 ```
 
-## Example
+There are two options for the flag `--chain_id`:
+
+- `testnet`: connect to the testnet.
+- `mainnet`: standalone mode.
 
-Currently, bytom is still in active development and a ton of work needs to be done, but we also provide the following content for these eager to do something with `bytom`.
+After that, you'll see `.bytomd` generated in current directory, then launch the node.
 
-### Set up a wallet and manage the key
+### launch
+
+``` bash
+$ ./bytomd node --mining
+```
 
-You can create an account via `create-key password`, which will generate a `keystore` file containing the keys under the project directory.
+available flags for `bytomd node`:
+
+```
+      --auth.disable                Disable rpc access authenticate
+      --mining                      Enable mining
+      --p2p.dial_timeout int        Set dial timeout (default 3)
+      --p2p.handshake_timeout int   Set handshake timeout (default 30)
+      --p2p.laddr string            Node listen address.
+      --p2p.max_num_peers int       Set max num peers (default 50)
+      --p2p.pex                     Enable Peer-Exchange
+      --p2p.seeds string            Comma delimited host:port seed nodes
+      --p2p.skip_upnp               Skip UPNP configuration
+      --prof_laddr string           Use http to profile bytomd programs
+      --wallet.disable              Disable wallet
+      --web.closed                  Lanch web browser or not
+```
+
+Given the `bytomd` node is running, the general workflow is as follows:
+
+- create key, then you can create account and asset.
+- send transaction, i.e., build, sign and submit transaction.
+- query all kinds of information, let's say, avaliable key, account, key, balances, transactions, etc.
+
+#### Dashboard
+
+Access the dashboard:
 
 ```bash
-$ ./bytomcli create-key account_name password   # Create an account named account_name using password
-$ ./bytomcli delete-key password pubkey         # Delete account pubkey
-$ ./bytomcli reset-password oldpassword newpassword pubkey  # Update password
+$ open http://localhost:9888/
 ```
 
-### Create and launch a single node
+### Create key
 
-When successfully building the project, the `bytom` and `bytomcli` binary should be present in `cmd/bytom/bytom` and `cmd/bytomcli/bytomcli`, respectively. The next step is to initialize the node:
+You can create a key with the following command:
 
 ```bash
-$ cd ./cmd/bytom
-$ ./bytom init --home ./.bytom
+$ ./bytomcli create-key alice 123
+{
+  "alias": "alice",
+  "xpub": "d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"
+}
 ```
 
-After that, you'll see `.bytom` generated in current directory, then launch the single node:
+list the keys:
 
-``` bash
-$ ./bytom node --home ./.bytom
+```bash
+$ ./bytomcli list-keys
 ```
 
-#### Asset issuance test
+### Create account
 
-Given the `bytom` node is running, you can use the provoided `issue-test` to test the asset issuance functionality:
+Create an account named `alice`:
 
 ```bash
-$ cd ./cmd/bytomcli
-$ ./bytomcli issue-test
+$ ./bytomcli create-account alice d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb
+{
+  "alias": "alice",
+  "id": "0CIT3OI100A04",
+  "key_index": 1,
+  "quorum": 1,
+  "xpubs": [
+    "d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"
+  ]
+}
 ```
-#### Asset issuance test step by step
-- Create an account
+
+Check out the new created account:
+
 ```bash
-$ ./bytomcli create-account alice
+$ ./bytomcli list-accounts
 ```
-then bash output:
+
+#### Multi-signature account
+
 ```bash
-xprv:80bc2cfa359eb27ec9f9ee666e6b9f9fefa7e98f1646982ceb7b5b6fb20e0241e2ef49382cf924275c841cd3692e2ffe84eb9fc0a3795cadc1b71ad9c57ee613
-xpub:bc4996423cf375294175bd3b649ed5b771080a7871dfc8b7bb525b3541069a8be2ef49382cf924275c841cd3692e2ffe84eb9fc0a3795cadc1b71ad9c57ee613
-responses:{acc04K9MCFBG0A04 alice [0xc4200966e0] 1 0xc4204be220}
-account id:acc04K9MCFBG0A04
+$ ./bytomcli list-keys
+0 :
+{
+  "alias": "default",
+  "xpub": "336150c3a63411f597d94aa26fe714a348b2e93f2c303d526bb225e5804466e366e58cff81fddaed7879586b92132d63c68b419856f85ca06abfc490a9990c38"
+}
+1 :
+{
+  "alias": "alice",
+  "xpub": "d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"
+}
+2 :
+{
+  "alias": "bob",
+  "xpub": "cb6057b683c5a341ea29e02ec5bb1e53691eb3b14c285138175d42b07d0551798977fc50203bde1dc2827a07f6f26237fa8ec3c6a2ef272ed80f9211f9c6ac64"
+}
 ```
-- Create an asset
+
 ```bash
-$ ./bytomcli create-asset gold
+$ ./bytomcli create-account multi_account d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb cb6057b683c5a341ea29e02ec5bb1e53691eb3b14c285138175d42b07d0551798977fc50203bde1dc2827a07f6f26237fa8ec3c6a2ef272ed80f9211f9c6ac64 -q 2
+{
+  "alias": "multi_account",
+  "id": "0CIT6J0QG0A06",
+  "key_index": 1,
+  "quorum": 2,
+  "xpubs": [
+    "cb6057b683c5a341ea29e02ec5bb1e53691eb3b14c285138175d42b07d0551798977fc50203bde1dc2827a07f6f26237fa8ec3c6a2ef272ed80f9211f9c6ac64",
+    "d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"
+  ]
+}
 ```
-then bash output:
+
+### Create asset
+
+Create an asset named `GOLD`:
+
 ```bash
-xprv:a89d5d5fa68af8ca8408d405db180bc5b2652d7f34bca753531861be3c1cbb6216a296e1fd0f59c7215b267f24f4620e30f7c3281fa4c7a5f29ad53d8d7822bb
-xpub:[98 55 100 48 102 100 53 101 54 55 55 49 48 52 97 100 50 100 51 51 98 49 56 98 98 100 55 55 50 51 98 53 102 51 101 97 56 55 49 52 48 53 57 54 50 56 55 48 49 97 50 99 97 100 101 51 51 102 100 100 97 53 56 51 49 54 97 50 57 54 101 49 102 100 48 102 53 57 99 55 50 49 53 98 50 54 55 102 50 52 102 52 54 50 48 101 51 48 102 55 99 51 50 56 49 102 97 52 99 55 97 53 102 50 57 97 100 53 51 100 56 100 55 56 50 50 98 98]
-responses:[{{4131000809721133708 15036469059929217352 9712753415038655527 16992088508821480533} gold [118 107 170 32 152 106 231 249 212 15 215 121 94 191 102 23 231 61 38 211 121 176 221 199 48 173 145 207 243 201 82 0 215 2 72 243 81 81 173 105 108 0 192] [0xc420020850] 1 0xc4204c1960 0xc4204c1980 true}]
-asset id:3954435976477a8cd0ac44f1813b994886caa1c546575c27ebd00678884d2455
+$ ./bytomcli create-asset GOLD d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb
+{
+  "alias": "GOLD",
+  "definition": {},
+  "id": "43e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397",
+  "issuance_program": "ae2035b53ed466a40e3d1073ffdcf1c7d0c4ffc439391f9ef5999b365ea467c96a3c5151ad",
+  "keys": [
+    {
+      "asset_derivation_path": [
+        "000100000000000000"
+      ],
+      "asset_pubkey": "35b53ed466a40e3d1073ffdcf1c7d0c4ffc439391f9ef5999b365ea467c96a3c0e8b6d5a67bd5fc66d7a19d4754df6de6cbf3b40fc6b02a75f140d77a1dbcda8",
+      "root_xpub": "d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"
+    }
+  ],
+  "quorum": 1
+}
 ```
-- Create & sign & submit a transaction
+
+Check out the new created asset:
+
 ```bash
-$ ./bytomcli sub-create-issue-tx acc04K9MCFBG0A04 3954435976477a8cd0ac44f1813b994886caa1c546575c27ebd00678884d2455 a89d5d5fa68af8ca8408d405db180bc5b2652d7f34bca753531861be3c1cbb6216a296e1fd0f59c7215b267f24f4620e30f7c3281fa4c7a5f29ad53d8d7822bb 10000
+$ ./bytomcli list-assets
 ```
-then bash output:
+
+#### Multi-signature asset
+
 ```bash
-To build transaction:
------------tpl:{version:1 serialized_size:314 result_ids:<71c3b949750c887e466422007cdd1a6a9f3449e3bacd43307e361e84d76fe37b> data:<130994550772:/* unknown wire type 7 */ 1642:/* unknown wire type 7 */ 10:17681930801800169409 159728:7652 9:4897805654558278394 9:/* unexpected EOF */ >min_time_ms:1506587706078 max_time_ms:1506588006078  [0xc4204c9060 0xc4204c91e0] true false}
-----------tpl transaction:version:1 serialized_size:314 result_ids:<71c3b949750c887e466422007cdd1a6a9f3449e3bacd43307e361e84d76fe37b> data:<130994550772:/* unknown wire type 7 */ 1642:/* unknown wire type 7 */ 10:17681930801800169409 159728:7652 9:4897805654558278394 9:/* unexpected EOF */ >min_time_ms:1506587706078 max_time_ms:1506588006078 
-----------btm inputs:&{1 [123 125] asset_id:</* proto: integer overflow */ >amount:1470000000000000000  [] []}
-----------issue inputs:&{1 [] 0xc4204c4120 [] []}
-xprv_asset:a89d5d5fa68af8ca8408d405db180bc5b2652d7f34bca753531861be3c1cbb6216a296e1fd0f59c7215b267f24f4620e30f7c3281fa4c7a5f29ad53d8d7822bb
-sign tpl:{version:1 serialized_size:314 result_ids:<71c3b949750c887e466422007cdd1a6a9f3449e3bacd43307e361e84d76fe37b> data:<130994550772:/* unknown wire type 7 */ 1642:/* unknown wire type 7 */ 10:17681930801800169409 159728:7652 9:4897805654558278394 9:/* unexpected EOF */ >min_time_ms:1506587706078 max_time_ms:1506588006078  [0xc4204c9060 0xc4204c91e0] true false}
-sign tpl's SigningInstructions:&{0 [0xc420010670]}
-SigningInstructions's SignatureWitnesses:&{0 [] [32 254 83 225 251 124 27 13 126 32 0 93 132 151 197 166 125 64 222 168 154 133 219 122 187 130 169 176 160 166 8 49 145 174 135] []}
-submit transaction:[map[id:cc4313fbae424bb945029adef193154f34de324316036e510bcc751d0013ccb7]]
+$ ./bytomcli create-asset SILVER d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb cb6057b683c5a341ea29e02ec5bb1e53691eb3b14c285138175d42b07d0551798977fc50203bde1dc2827a07f6f26237fa8ec3c6a2ef272ed80f9211f9c6ac64
+{
+  "alias": "SILVER",
+  "definition": {},
+  "id": "50cd5b0ecfdfe388fc0bc6b74df6becd94f1e52e1913a449a473bba87745fe30",
+  "issuance_program": "ae20936178877c2a3a2df9c3733e2ac6f7e99477314c54e214348abb0d4cbdace810208d064a125805493cb99be9c19ed6a356c97753fdfe52fade337fa598c3c59b8c5152ad",
+  "keys": [
+    {
+      "asset_derivation_path": [
+        "000200000000000000"
+      ],
+      "asset_pubkey": "936178877c2a3a2df9c3733e2ac6f7e99477314c54e214348abb0d4cbdace810f9ef97f8edd43707069426ff1ac1d2fe96d23c5e005ac5cb52be2a7de82d2a92",
+      "root_xpub": "cb6057b683c5a341ea29e02ec5bb1e53691eb3b14c285138175d42b07d0551798977fc50203bde1dc2827a07f6f26237fa8ec3c6a2ef272ed80f9211f9c6ac64"
+    },
+    {
+      "asset_derivation_path": [
+        "000200000000000000"
+      ],
+      "asset_pubkey": "8d064a125805493cb99be9c19ed6a356c97753fdfe52fade337fa598c3c59b8c4eb0b479d566c0efe72ab69f2273ab4b6a6dce9e1e3657839698be6c53e9d04a",
+      "root_xpub": "d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"
+    }
+  ],
+  "quorum": 1
+}
 ```
-### Multiple node
 
-Get the submodule depenency for multi-node test:
+### Sending transaction
+
+Every asset-related action is trigger via sending a transaction, which requires two steps to complete, i.e., `build-transaction` and `sign-submit-transaction`. Don't forget to enable `--mining`.
+
+#### Issue
+
+##### `build-transaction`
+
+Let's say, issue 10000 GOLD to alice:
+```bash
+$ ./bytomcli create-account-receiver alice
+{
+  "address": "bm1q7s24rra4j05yhec9chry2c9trd6qa8gjr6cue3",
+  "control_program": "0014f415518fb593e84be705c5c64560ab1b740e9d12"
+}
+```
 
 ```bash
-$ git submodule update --init --recursive
+$ ./bytomcli build-transaction -t issue alice GOLD 10000 -a bm1q7s24rra4j05yhec9chry2c9trd6qa8gjr6cue3 --alias
+Template Type: issue
+{"allow_additional_actions":false,"raw_transaction":"070100020160015ee56e4d688e98160067fa25be520d3a5a90e63838b5ff6363997c7c9b962796daffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8094ebdc030501160014f415518fb593e84be705c5c64560ab1b740e9d120100012c000887c3aad437888d0143e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397904e29000125ae2035b53ed466a40e3d1073ffdcf1c7d0c4ffc439391f9ef5999b365ea467c96a3c5151ad0002013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80baa6d30301160014c0c4fb15dd132be34e6dcaea3c38df1869ebcdbf00013a43e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397904e01160014f415518fb593e84be705c5c64560ab1b740e9d1200","signing_instructions":[{"position":0,"witness_components":[{"keys":[{"derivation_path":["010100000000000000","0200000000000000"],"xpub":"d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"}],"quorum":1,"signatures":null,"type":"raw_tx_signature"},{"type":"data","value":"4dc1e7f4e9710378cb80f180e159005a5ca8934d68df6136b782fe08d23d7b0a"}]},{"position":1,"witness_components":[{"keys":[{"derivation_path":["000100000000000000"],"xpub":"d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"}],"quorum":1,"signatures":null,"type":"raw_tx_signature"}]}]}
 ```
 
-Create the first node `bytom0` and second node `bytom1`:
+The response of `build-transaction` will be used in the following `sign-submit-transaction` command.
+
+##### `sign-submit-transaction`
 
 ```bash
-$ cd cmd/bytom/2node-test
-$ ./test.sh bytom0  # Start the first node
-$ ./test.sh bytom1  # Start the second node
+$ ./bytomcli sign-submit-transaction '{"allow_additional_actions":false,"raw_transaction":"070100020160015ee56e4d688e98160067fa25be520d3a5a90e63838b5ff6363997c7c9b962796daffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8094ebdc030501160014f415518fb593e84be705c5c64560ab1b740e9d120100012c000887c3aad437888d0143e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397904e29000125ae2035b53ed466a40e3d1073ffdcf1c7d0c4ffc439391f9ef5999b365ea467c96a3c5151ad0002013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80baa6d30301160014c0c4fb15dd132be34e6dcaea3c38df1869ebcdbf00013a43e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397904e01160014f415518fb593e84be705c5c64560ab1b740e9d1200","signing_instructions":[{"position":0,"witness_components":[{"keys":[{"derivation_path":["010100000000000000","0200000000000000"],"xpub":"d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"}],"quorum":1,"signatures":null,"type":"raw_tx_signature"},{"type":"data","value":"4dc1e7f4e9710378cb80f180e159005a5ca8934d68df6136b782fe08d23d7b0a"}]},{"position":1,"witness_components":[{"keys":[{"derivation_path":["000100000000000000"],"xpub":"d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"}],"quorum":1,"signatures":null,"type":"raw_tx_signature"}]}]}' -p 123 
+
+{
+  "tx_id": "62fe1716f2b8fe012578a3a8f6b02bd2fa548fef5bba792ea78673e07b38198d"
+}
 ```
 
-Then we have two nodes:
+When the transaction is on-chain, query the balances:
 
 ```bash
-$ curl -X POST --data '{"jsonrpc":"2.0", "method": "net_info", "params":[], "id":"67"}' http://127.0.0.1:46657
+# alice should have 10000 GOLD now
+$ ./bytomcli list-balances
+0 :
+{
+  "account_alias": "default",
+  "account_id": "0CIT2D2O00A02",
+  "amount": 2098770000000,
+  "asset_alias": "BTM",
+  "asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+}
+1 :
+{
+  "account_alias": "alice",
+  "account_id": "0CIT3OI100A04",
+  "amount": 10000,
+  "asset_alias": "GOLD",
+  "asset_id": "43e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397"
+}
+2 :
+{
+  "account_alias": "alice",
+  "account_id": "0CIT3OI100A04",
+  "amount": 4980000000,
+  "asset_alias": "BTM",
+  "asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+}
+```
+
+#### Spend
+
+Alice pays Bob `<payment_amount>`, e.g., 1000, `GOLD`:
+
+##### `create-account-receiver`
+
+Before you transfer an asset to another account, you have to know his `control_program`. This means the receiver needs to send you his `control_program` first.
+
+```bash
+$ ./bytomcli create-account-receiver bob
+{
+  "address": "bm1qhurffd3gqkc3pttqfqpsz8w04jnl5z97798tpt",
+  "control_program": "0014bf0694b62805b110ad604803011dcfaca7fa08be"
+}
 ```
 
-If everything goes well, we'll see the following response:
+##### `build-transaction`
 
 ```bash
+# ./bytomcli build-transaction -t spend <sender_account> <asset> <amount> --alias -r <receiver_control_program>
+$ ./bytomcli build-transaction -t spend alice GOLD 1000 --alias -r 0014bf0694b62805b110ad604803011dcfaca7fa08be
+Template Type: spend
+{"allow_additional_actions":false,"raw_transaction":"070100020160015eba7bbf304b94623b1efb414845f701e64e6c63011984e65dcf214d560f505e28ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80baa6d3030001160014c0c4fb15dd132be34e6dcaea3c38df1869ebcdbf0100015d015bba7bbf304b94623b1efb414845f701e64e6c63011984e65dcf214d560f505e2843e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397904e0101160014f415518fb593e84be705c5c64560ab1b740e9d12010003013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80e0e1c903011600144457a5103dc682327fe2ef662f812dce3f97ffae00013a43e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397a846011600147460e50dc0b0313d22796c899c28f795872b229600013a43e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397e80701160014bf0694b62805b110ad604803011dcfaca7fa08be00","signing_instructions":[{"position":0,"witness_components":[{"keys":[{"derivation_path":["010100000000000000","0300000000000000"],"xpub":"d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"}],"quorum":1,"signatures":null,"type":"raw_tx_signature"},{"type":"data","value":"eef67105644a1f146ba313a7ea98ceac2534a9f4cf1aa3775b726476db9c3dc0"}]},{"position":1,"witness_components":[{"keys":[{"derivation_path":["010100000000000000","0200000000000000"],"xpub":"d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"}],"quorum":1,"signatures":null,"type":"raw_tx_signature"},{"type":"data","value":"4dc1e7f4e9710378cb80f180e159005a5ca8934d68df6136b782fe08d23d7b0a"}]}]}
+```
+
+##### `sign-submit-transaction`
+
+```bash
+$ ./bytomcli sign-submit-transaction '{"allow_additional_actions":false,"raw_transaction":"070100020160015eba7bbf304b94623b1efb414845f701e64e6c63011984e65dcf214d560f505e28ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80baa6d3030001160014c0c4fb15dd132be34e6dcaea3c38df1869ebcdbf0100015d015bba7bbf304b94623b1efb414845f701e64e6c63011984e65dcf214d560f505e2843e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397904e0101160014f415518fb593e84be705c5c64560ab1b740e9d12010003013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80e0e1c903011600144457a5103dc682327fe2ef662f812dce3f97ffae00013a43e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397a846011600147460e50dc0b0313d22796c899c28f795872b229600013a43e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397e80701160014bf0694b62805b110ad604803011dcfaca7fa08be00","signing_instructions":[{"position":0,"witness_components":[{"keys":[{"derivation_path":["010100000000000000","0300000000000000"],"xpub":"d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"}],"quorum":1,"signatures":null,"type":"raw_tx_signature"},{"type":"data","value":"eef67105644a1f146ba313a7ea98ceac2534a9f4cf1aa3775b726476db9c3dc0"}]},{"position":1,"witness_components":[{"keys":[{"derivation_path":["010100000000000000","0200000000000000"],"xpub":"d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"}],"quorum":1,"signatures":null,"type":"raw_tx_signature"},{"type":"data","value":"4dc1e7f4e9710378cb80f180e159005a5ca8934d68df6136b782fe08d23d7b0a"}]}]}'
+
+
+{
+  "txid": "3bf01bd21d7bbf3eb1c6e27e5646be1c4a7bd5602125eebf28f430246b08c226"
+}
+```
+
+```bash
+$./bytomcli list-balances
+0 :
+{
+  "account_alias": "default",
+  "account_id": "0CIT2D2O00A02",
+  "amount": 2758790000000,
+  "asset_alias": "BTM",
+  "asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+}
+1 :
+{
+  "account_alias": "alice",
+  "account_id": "0CIT3OI100A04",
+  "amount": 9000,
+  "asset_alias": "GOLD",
+  "asset_id": "43e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397"
+}
+2 :
 {
-  "jsonrpc": "2.0",
-  "id": "67",
-  "result": {
-    "listening": true,
-    "listeners": [
-      "Listener(@192.168.199.178:3332)"
-    ],
-    "peers": [
-      {
-        "node_info": {
-          "pub_key": "03571A5CE8B35E95E2357DB2823E9EB76EB42D5CCC5F8E68315388832878C011",
-          "moniker": "anonymous",
-          "network": "chain0",
-          "remote_addr": "127.0.0.1:51058",
-          "listen_addr": "192.168.199.178:3333",
-          "version": "0.1.0",
-          "other": [
-            "wire_version=0.6.2",
-            "p2p_version=0.5.0",
-            "rpc_addr=tcp://0.0.0.0:46658"
-          ]
-        },
-......
+  "account_alias": "alice",
+  "account_id": "0CIT3OI100A04",
+  "amount": 4960000000,
+  "asset_alias": "BTM",
+  "asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+}
+3 :
+{
+  "account_alias": "bob",
+  "account_id": "0CITLN2KG0A08",
+  "amount": 1000,
+  "asset_alias": "GOLD",
+  "asset_id": "43e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397"
+}
+```
+
+#### Transfer BTM
+
+```bash
+# ./bytomcli build-transaction -t spend <sender_account> <asset> <amount> --alias -r <receiver_control_program>
+$ ./bytomcli build-transaction -t spend alice BTM 1000000000 --alias -r 0014bf0694b62805b110ad604803011dcfaca7fa08be
+Template Type: spend
+{"allow_additional_actions":false,"raw_transaction":"070100020160015ee56e4d688e98160067fa25be520d3a5a90e63838b5ff6363997c7c9b962796daffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8094ebdc030201160014f415518fb593e84be705c5c64560ab1b740e9d1201000160015e5685c051b6a7f1631e0505ea99a61997c1b8322148321eb864435c8516a5a8eaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80e0e1c90300011600144457a5103dc682327fe2ef662f812dce3f97ffae010002013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80869dc003011600146026f938bbcf6b6b90eb9d8fbb8c1725e0ae3d0b00013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8094ebdc0301160014bf0694b62805b110ad604803011dcfaca7fa08be00","signing_instructions":[{"position":0,"witness_components":[{"keys":[{"derivation_path":["010100000000000000","0200000000000000"],"xpub":"d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"}],"quorum":1,"signatures":null,"type":"raw_tx_signature"},{"type":"data","value":"4dc1e7f4e9710378cb80f180e159005a5ca8934d68df6136b782fe08d23d7b0a"}]},{"position":1,"witness_components":[{"keys":[{"derivation_path":["010100000000000000","0400000000000000"],"xpub":"d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"}],"quorum":1,"signatures":null,"type":"raw_tx_signature"},{"type":"data","value":"2cfbc821a459ef53b9ee4a170b735e54f968f239bf9155712f4b88256f97d54a"}]}]}
+```
+
+```bash
+$ ./bytomcli sign-submit-transaction '{"allow_additional_actions":false,"raw_transaction":"070100020160015ee56e4d688e98160067fa25be520d3a5a90e63838b5ff6363997c7c9b962796daffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8094ebdc030201160014f415518fb593e84be705c5c64560ab1b740e9d1201000160015e5685c051b6a7f1631e0505ea99a61997c1b8322148321eb864435c8516a5a8eaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80e0e1c90300011600144457a5103dc682327fe2ef662f812dce3f97ffae010002013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80869dc003011600146026f938bbcf6b6b90eb9d8fbb8c1725e0ae3d0b00013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8094ebdc0301160014bf0694b62805b110ad604803011dcfaca7fa08be00","signing_instructions":[{"position":0,"witness_components":[{"keys":[{"derivation_path":["010100000000000000","0200000000000000"],"xpub":"d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"}],"quorum":1,"signatures":null,"type":"raw_tx_signature"},{"type":"data","value":"4dc1e7f4e9710378cb80f180e159005a5ca8934d68df6136b782fe08d23d7b0a"}]},{"position":1,"witness_components":[{"keys":[{"derivation_path":["010100000000000000","0400000000000000"],"xpub":"d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"}],"quorum":1,"signatures":null,"type":"raw_tx_signature"},{"type":"data","value":"2cfbc821a459ef53b9ee4a170b735e54f968f239bf9155712f4b88256f97d54a"}]}]}' -p 123
+
+
+{
+  "tx_id": "1c84c8d8dae7675114f9de970e221ec9e07e1787f6e72ac6e95a03fced7d22cb"
+}
+```
+
+```bash
+$ ./bytomcli list-balances
+0 :
+{
+  "account_alias": "default",
+  "account_id": "0CIT2D2O00A02",
+  "amount": 3212560000000,
+  "asset_alias": "BTM",
+  "asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+}
+1 :
+{
+  "account_alias": "alice",
+  "account_id": "0CIT3OI100A04",
+  "amount": 9000,
+  "asset_alias": "GOLD",
+  "asset_id": "43e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397"
+}
+2 :
+{
+  "account_alias": "alice",
+  "account_id": "0CIT3OI100A04",
+  "amount": 3940000000,
+  "asset_alias": "BTM",
+  "asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+}
+3 :
+{
+  "account_alias": "bob",
+  "account_id": "0CITLN2KG0A08",
+  "amount": 1000,
+  "asset_alias": "GOLD",
+  "asset_id": "43e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397"
+}
+4 :
+{
+  "account_alias": "bob",
+  "account_id": "0CITLN2KG0A08",
+  "amount": 1000000000,
+  "asset_alias": "BTM",
+  "asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+}
+```
+
+## Running Bytom in Docker
+
+Ensure your [Docker](https://www.docker.com/) version is 17.05 or higher.
+
+```bash
+$ docker build -t bytom .
 ```
 
 ## Contributing
 
-Thank you for considering to help out with the source code! Any contributions are highly appreciated, and we are grateful for even the smallest of fixes!
+Thank you for considering helping out with the source code! Any contributions are highly appreciated, and we are grateful for even the smallest of fixes!
 
 If you run into an issue, feel free to [file one](https://github.com/Bytom/bytom/issues/) in this repository. We are glad to help!