OSDN Git Service

edit sync logic, make it fast (#1176)
[bytom/bytom.git] / README.md
1 Bytom
2 =====
3 [![Build Status](https://travis-ci.org/Bytom/bytom.svg)](https://travis-ci.org/Bytom/bytom)
4 [![AGPL v3](https://img.shields.io/badge/license-AGPL%20v3-brightgreen.svg)](./LICENSE)
5
6 ## Table of Contents
7 <!-- vim-markdown-toc GFM -->
8
9 * [What is Bytom?](#what-is-bytom)
10 * [Build from source](#build-from-source)
11   * [Requirements](#requirements)
12   * [Installation](#installation)
13     * [Get the source code](#get-the-source-code)
14     * [Build](#build)
15 * [Example](#example)
16   * [Initialize](#initialize)
17   * [launch](#launch)
18     * [Dashboard](#dashboard)
19   * [Create key](#create-key)
20   * [Create account](#create-account)
21     * [Multi-signature account](#multi-signature-account)
22   * [Create asset](#create-asset)
23     * [Multi-signature asset](#multi-signature-asset)
24   * [Sending transaction](#sending-transaction)
25     * [Issue](#issue)
26       * [`build-transaction`](#build-transaction)
27       * [`sign-submit-transaction`](#sign-submit-transaction)
28     * [Spend](#spend)
29       * [`create-account-receiver`](#create-account-receiver)
30       * [`build-transaction`](#build-transaction-1)
31       * [`sign-submit-transaction`](#sign-submit-transaction-1)
32     * [Transfer BTM](#transfer-btm)
33 * [Running Bytom in Docker](#running-bytom-in-docker)
34 * [Contributing](#contributing)
35 * [License](#license)
36
37 <!-- vim-markdown-toc -->
38
39 ## What is Bytom?
40
41 Bytom is software designed to operate and connect to highly scalable blockchain networks confirming to the Bytom Blockchain Protocol, which allows partipicants to define, issue and transfer digitial assets on a multi-asset shared ledger. Please refer to the [White Paper](https://github.com/Bytom/wiki/blob/master/White-Paper/%E6%AF%94%E5%8E%9F%E9%93%BE%E6%8A%80%E6%9C%AF%E7%99%BD%E7%9A%AE%E4%B9%A6-%E8%8B%B1%E6%96%87%E7%89%88.md) for more details.
42
43 In the current state `bytom` is able to:
44
45 - Manage key, account as well as asset
46 - Send transactions, i.e., issue, spend and retire asset
47
48 ## Build from source
49
50 ### Requirements
51
52 - [Go](https://golang.org/doc/install) version 1.8 or higher, with `$GOPATH` set to your preferred directory
53
54 ### Installation
55
56 Ensure Go with the supported version is installed properly:
57
58 ```bash
59 $ go version
60 $ go env GOROOT GOPATH
61 ```
62
63 #### Get the source code
64
65 ``` bash
66 $ git clone https://github.com/Bytom/bytom.git $GOPATH/src/github.com/bytom
67 ```
68
69 #### Build
70
71 ``` bash
72 $ cd $GOPATH/src/github.com/bytom
73 $ make bytomd    # build bytomd
74 $ make bytomcli  # build bytomcli
75 ```
76
77 When successfully building the project, the `bytom` and `bytomcli` binary should be present in `cmd/bytomd` and `cmd/bytomcli` directory, respectively.
78
79 __simd feature:__
80
81 You could enable the _simd_ feature to speed up the _PoW_ verification (e.g., during mining and block verification) by simply:
82 ```
83 bytomd node --simd.enable
84 ```
85
86 To enable this feature you will need to compile from the source code by yourself, and `make bytomd-simd`. 
87
88 What is more,
89
90 + if you are using _Mac_, please make sure _llvm_ is installed by `brew install llvm`.
91 + if you are using _Windows_, please make sure _mingw-w64_ is installed and set up the _PATH_ environment variable accordingly.
92
93 ## Example
94
95 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`.
96
97 ### Initialize
98
99 First of all, initialize the node:
100
101 ```bash
102 $ cd ./cmd/bytomd
103 $ ./bytomd init --chain_id mainnet
104 ```
105
106 There are three options for the flag `--chain_id`:
107
108 - `mainnet`: connect to the mainnet.
109 - `testnet`: connect to the testnet wisdom.
110 - `solonet`: standalone mode.
111
112 After that, you'll see `config.toml` generated, then launch the node.
113
114 ### launch
115
116 ``` bash
117 $ ./bytomd node --mining
118 ```
119
120 available flags for `bytomd node`:
121
122 ```
123       --auth.disable                Disable rpc access authenticate
124       --chain_id string             Select network type
125   -h, --help                        help for node
126       --mining                      Enable mining
127       --p2p.dial_timeout int        Set dial timeout (default 3)
128       --p2p.handshake_timeout int   Set handshake timeout (default 30)
129       --p2p.laddr string            Node listen address.
130       --p2p.max_num_peers int       Set max num peers (default 50)
131       --p2p.pex                     Enable Peer-Exchange  (default true)
132       --p2p.seeds string            Comma delimited host:port seed nodes
133       --p2p.skip_upnp               Skip UPNP configuration
134       --prof_laddr string           Use http to profile bytomd programs
135       --vault_mode                  Run in the offline enviroment
136       --wallet.disable              Disable wallet
137       --wallet.rescan               Rescan wallet
138       --web.closed                  Lanch web browser or not
139 ```
140
141 Given the `bytomd` node is running, the general workflow is as follows:
142
143 - create key, then you can create account and asset.
144 - send transaction, i.e., build, sign and submit transaction.
145 - query all kinds of information, let's say, avaliable key, account, key, balances, transactions, etc.
146
147 #### Dashboard
148
149 Access the dashboard:
150
151 ```bash
152 $ open http://localhost:9888/
153 ```
154
155 ### Create key
156
157 You can create a key with the following command:
158
159 ```bash
160 $ ./bytomcli create-key alice 123
161 {
162   "alias": "alice",
163   "xpub": "d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"
164 }
165 ```
166
167 list the keys:
168
169 ```bash
170 $ ./bytomcli list-keys
171 ```
172
173 ### Create account
174
175 Create an account named `alice`:
176
177 ```bash
178 $ ./bytomcli create-account alice d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb
179 {
180   "alias": "alice",
181   "id": "0CIT3OI100A04",
182   "key_index": 1,
183   "quorum": 1,
184   "xpubs": [
185     "d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"
186   ]
187 }
188 ```
189
190 Check out the new created account:
191
192 ```bash
193 $ ./bytomcli list-accounts
194 ```
195
196 #### Multi-signature account
197
198 ```bash
199 $ ./bytomcli list-keys
200 0 :
201 {
202   "alias": "default",
203   "xpub": "336150c3a63411f597d94aa26fe714a348b2e93f2c303d526bb225e5804466e366e58cff81fddaed7879586b92132d63c68b419856f85ca06abfc490a9990c38"
204 }
205 1 :
206 {
207   "alias": "alice",
208   "xpub": "d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"
209 }
210 2 :
211 {
212   "alias": "bob",
213   "xpub": "cb6057b683c5a341ea29e02ec5bb1e53691eb3b14c285138175d42b07d0551798977fc50203bde1dc2827a07f6f26237fa8ec3c6a2ef272ed80f9211f9c6ac64"
214 }
215 ```
216
217 ```bash
218 $ ./bytomcli create-account multi_account d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb cb6057b683c5a341ea29e02ec5bb1e53691eb3b14c285138175d42b07d0551798977fc50203bde1dc2827a07f6f26237fa8ec3c6a2ef272ed80f9211f9c6ac64 -q 2
219 {
220   "alias": "multi_account",
221   "id": "0CIT6J0QG0A06",
222   "key_index": 1,
223   "quorum": 2,
224   "xpubs": [
225     "cb6057b683c5a341ea29e02ec5bb1e53691eb3b14c285138175d42b07d0551798977fc50203bde1dc2827a07f6f26237fa8ec3c6a2ef272ed80f9211f9c6ac64",
226     "d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"
227   ]
228 }
229 ```
230
231 ### Create asset
232
233 Create an asset named `GOLD`:
234
235 ```bash
236 $ ./bytomcli create-asset GOLD d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb
237 {
238   "alias": "GOLD",
239   "definition": {},
240   "id": "43e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397",
241   "issuance_program": "ae2035b53ed466a40e3d1073ffdcf1c7d0c4ffc439391f9ef5999b365ea467c96a3c5151ad",
242   "keys": [
243     {
244       "asset_derivation_path": [
245         "000100000000000000"
246       ],
247       "asset_pubkey": "35b53ed466a40e3d1073ffdcf1c7d0c4ffc439391f9ef5999b365ea467c96a3c0e8b6d5a67bd5fc66d7a19d4754df6de6cbf3b40fc6b02a75f140d77a1dbcda8",
248       "root_xpub": "d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"
249     }
250   ],
251   "quorum": 1
252 }
253 ```
254
255 Check out the new created asset:
256
257 ```bash
258 $ ./bytomcli list-assets
259 ```
260
261 #### Multi-signature asset
262
263 ```bash
264 $ ./bytomcli create-asset SILVER d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb cb6057b683c5a341ea29e02ec5bb1e53691eb3b14c285138175d42b07d0551798977fc50203bde1dc2827a07f6f26237fa8ec3c6a2ef272ed80f9211f9c6ac64
265 {
266   "alias": "SILVER",
267   "definition": {},
268   "id": "50cd5b0ecfdfe388fc0bc6b74df6becd94f1e52e1913a449a473bba87745fe30",
269   "issuance_program": "ae20936178877c2a3a2df9c3733e2ac6f7e99477314c54e214348abb0d4cbdace810208d064a125805493cb99be9c19ed6a356c97753fdfe52fade337fa598c3c59b8c5152ad",
270   "keys": [
271     {
272       "asset_derivation_path": [
273         "000200000000000000"
274       ],
275       "asset_pubkey": "936178877c2a3a2df9c3733e2ac6f7e99477314c54e214348abb0d4cbdace810f9ef97f8edd43707069426ff1ac1d2fe96d23c5e005ac5cb52be2a7de82d2a92",
276       "root_xpub": "cb6057b683c5a341ea29e02ec5bb1e53691eb3b14c285138175d42b07d0551798977fc50203bde1dc2827a07f6f26237fa8ec3c6a2ef272ed80f9211f9c6ac64"
277     },
278     {
279       "asset_derivation_path": [
280         "000200000000000000"
281       ],
282       "asset_pubkey": "8d064a125805493cb99be9c19ed6a356c97753fdfe52fade337fa598c3c59b8c4eb0b479d566c0efe72ab69f2273ab4b6a6dce9e1e3657839698be6c53e9d04a",
283       "root_xpub": "d91df216da6c5641ef454c8da1e56362f86ed80d8b8fc26ab77746e1b92d6d3aa8023fe300e4c74036460d01349e4eb25cb3d7379bad855879017bc1c76165bb"
284     }
285   ],
286   "quorum": 1
287 }
288 ```
289
290 ### Sending transaction
291
292 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`.
293
294 #### Issue
295
296 ##### `build-transaction`
297
298 Let's say, issue 10000 GOLD to alice:
299 ```bash
300 $ ./bytomcli create-account-receiver alice
301 {
302   "address": "bm1q7s24rra4j05yhec9chry2c9trd6qa8gjr6cue3",
303   "control_program": "0014f415518fb593e84be705c5c64560ab1b740e9d12"
304 }
305 ```
306
307 ```bash
308 $ ./bytomcli build-transaction -t issue alice GOLD 10000 -a bm1q7s24rra4j05yhec9chry2c9trd6qa8gjr6cue3 --alias
309 Template Type: issue
310 {"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"}]}]}
311 ```
312
313 The response of `build-transaction` will be used in the following `sign-submit-transaction` command.
314
315 ##### `sign-submit-transaction`
316
317 ```bash
318 $ ./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 
319
320 {
321   "tx_id": "62fe1716f2b8fe012578a3a8f6b02bd2fa548fef5bba792ea78673e07b38198d"
322 }
323 ```
324
325 When the transaction is on-chain, query the balances:
326
327 ```bash
328 # alice should have 10000 GOLD now
329 $ ./bytomcli list-balances
330 0 :
331 {
332   "account_alias": "default",
333   "account_id": "0CIT2D2O00A02",
334   "amount": 2098770000000,
335   "asset_alias": "BTM",
336   "asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
337 }
338 1 :
339 {
340   "account_alias": "alice",
341   "account_id": "0CIT3OI100A04",
342   "amount": 10000,
343   "asset_alias": "GOLD",
344   "asset_id": "43e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397"
345 }
346 2 :
347 {
348   "account_alias": "alice",
349   "account_id": "0CIT3OI100A04",
350   "amount": 4980000000,
351   "asset_alias": "BTM",
352   "asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
353 }
354 ```
355
356 #### Spend
357
358 Alice pays Bob `<payment_amount>`, e.g., 1000, `GOLD`:
359
360 ##### `create-account-receiver`
361
362 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.
363
364 ```bash
365 $ ./bytomcli create-account-receiver bob
366 {
367   "address": "bm1qhurffd3gqkc3pttqfqpsz8w04jnl5z97798tpt",
368   "control_program": "0014bf0694b62805b110ad604803011dcfaca7fa08be"
369 }
370 ```
371
372 ##### `build-transaction`
373
374 ```bash
375 # ./bytomcli build-transaction -t spend <sender_account> <asset> <amount> --alias -r <receiver_control_program>
376 $ ./bytomcli build-transaction -t spend alice GOLD 1000 --alias -r 0014bf0694b62805b110ad604803011dcfaca7fa08be
377 Template Type: spend
378 {"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"}]}]}
379 ```
380
381 ##### `sign-submit-transaction`
382
383 ```bash
384 $ ./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"}]}]}'
385
386
387 {
388   "txid": "3bf01bd21d7bbf3eb1c6e27e5646be1c4a7bd5602125eebf28f430246b08c226"
389 }
390 ```
391
392 ```bash
393 $./bytomcli list-balances
394 0 :
395 {
396   "account_alias": "default",
397   "account_id": "0CIT2D2O00A02",
398   "amount": 2758790000000,
399   "asset_alias": "BTM",
400   "asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
401 }
402 1 :
403 {
404   "account_alias": "alice",
405   "account_id": "0CIT3OI100A04",
406   "amount": 9000,
407   "asset_alias": "GOLD",
408   "asset_id": "43e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397"
409 }
410 2 :
411 {
412   "account_alias": "alice",
413   "account_id": "0CIT3OI100A04",
414   "amount": 4960000000,
415   "asset_alias": "BTM",
416   "asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
417 }
418 3 :
419 {
420   "account_alias": "bob",
421   "account_id": "0CITLN2KG0A08",
422   "amount": 1000,
423   "asset_alias": "GOLD",
424   "asset_id": "43e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397"
425 }
426 ```
427
428 #### Transfer BTM
429
430 ```bash
431 # ./bytomcli build-transaction -t spend <sender_account> <asset> <amount> --alias -r <receiver_control_program>
432 $ ./bytomcli build-transaction -t spend alice BTM 1000000000 --alias -r 0014bf0694b62805b110ad604803011dcfaca7fa08be
433 Template Type: spend
434 {"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"}]}]}
435 ```
436
437 ```bash
438 $ ./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
439
440
441 {
442   "tx_id": "1c84c8d8dae7675114f9de970e221ec9e07e1787f6e72ac6e95a03fced7d22cb"
443 }
444 ```
445
446 ```bash
447 $ ./bytomcli list-balances
448 0 :
449 {
450   "account_alias": "default",
451   "account_id": "0CIT2D2O00A02",
452   "amount": 3212560000000,
453   "asset_alias": "BTM",
454   "asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
455 }
456 1 :
457 {
458   "account_alias": "alice",
459   "account_id": "0CIT3OI100A04",
460   "amount": 9000,
461   "asset_alias": "GOLD",
462   "asset_id": "43e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397"
463 }
464 2 :
465 {
466   "account_alias": "alice",
467   "account_id": "0CIT3OI100A04",
468   "amount": 3940000000,
469   "asset_alias": "BTM",
470   "asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
471 }
472 3 :
473 {
474   "account_alias": "bob",
475   "account_id": "0CITLN2KG0A08",
476   "amount": 1000,
477   "asset_alias": "GOLD",
478   "asset_id": "43e89d8a5d8f4bb2fcd92621ace61d476c8237075ada6a9e80db931bbdb6c397"
479 }
480 4 :
481 {
482   "account_alias": "bob",
483   "account_id": "0CITLN2KG0A08",
484   "amount": 1000000000,
485   "asset_alias": "BTM",
486   "asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
487 }
488 ```
489
490 ## Running Bytom in Docker
491
492 Ensure your [Docker](https://www.docker.com/) version is 17.05 or higher.
493
494 ```bash
495 $ docker build -t bytom .
496 ```
497
498 For the usage please refer to [here](https://github.com/Bytom/bytom/wiki/Running-in-Docker).
499
500 ## Contributing
501
502 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!
503
504 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!
505
506 ## License
507
508 [AGPL v3](./LICENSE)