OSDN Git Service

Merge branch 'demo'
[bytom/bytom.git] / README.md
1 Bytom
2 =====
3
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   * [Set up a wallet and manage the key](#set-up-a-wallet-and-manage-the-key)
17   * [Create and launch a single node](#create-and-launch-a-single-node)
18     * [Asset issuance test](#asset-issuance-test)
19   * [Multiple node](#multiple-node)
20 * [Contributing](#contributing)
21 * [License](#license)
22
23 <!-- vim-markdown-toc -->
24
25 ## What is Bytom?
26
27 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.
28
29 In the current state `bytom` is able to:
30
31 - Issue assets
32 - Manage account as well as asset
33
34 ## Build from source
35
36 ### Requirements
37
38 - [Go](https://golang.org/doc/install) version 1.8 or higher, with `$GOPATH` set to your preferred directory
39
40 ### Installation
41
42 Ensure Go with the supported version is installed properly:
43
44 ```bash
45 $ go version
46 $ go env GOROOT GOPATH
47 ```
48
49 #### Get the source code
50
51 ``` bash
52 $ git clone https://github.com/Bytom/bytom $GOPATH/src/github.com/bytom
53 ```
54
55 #### Build
56
57 - Bytom
58
59 ``` bash
60 $ cd $GOPATH/src/github.com/bytom
61 $ make install
62 $ cd ./cmd/bytom
63 $ go build
64 ```
65
66 - Bytomcli
67
68 ```go
69 $ cd $GOPATH/src/github.com/bytom/cmd/bytomcli
70 $ go build
71 ```
72
73 ## Example
74
75 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`.
76
77 ### Set up a wallet and manage the key
78
79 You can create an account via `create-key password`, which will generate a `keystore` file containing the keys under the project directory.
80
81 ```bash
82 $ ./bytomcli create-key account_name password   # Create an account named account_name using password
83 $ ./bytomcli delete-key password pubkey         # Delete account pubkey
84 $ ./bytomcli reset-password oldpassword newpassword pubkey  # Update password
85 ```
86
87 ### Create and launch a single node
88
89 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:
90
91 ```bash
92 $ cd ./cmd/bytom
93 $ ./bytom init --home ./.bytom
94 ```
95
96 After that, you'll see `.bytom` generated in current directory, then launch the single node:
97
98 ``` bash
99 $ ./bytom node --home ./.bytom
100 ```
101
102 #### Asset issuance test
103
104 Given the `bytom` node is running, you can use the provoided `issue-test` to test the asset issuance functionality:
105
106 ```bash
107 $ cd ./cmd/bytomcli
108 $ ./bytomcli issue-test
109 ```
110
111 ### Multiple node
112
113 Get the submodule depenency for multi-node test:
114
115 ```bash
116 $ git submodule update --init --recursive
117 ```
118
119 Create the first node `bytom0` and second node `bytom1`:
120
121 ```bash
122 $ cd cmd/bytom/2node-test
123 $ ./test.sh bytom0  # Start the first node
124 $ ./test.sh bytom1  # Start the second node
125 ```
126
127 Then we have two nodes:
128
129 ```bash
130 $ curl -X POST --data '{"jsonrpc":"2.0", "method": "net_info", "params":[], "id":"67"}' http://127.0.0.1:46657
131 ```
132
133 If everything goes well, we'll see the following response:
134
135 ```bash
136 {
137   "jsonrpc": "2.0",
138   "id": "67",
139   "result": {
140     "listening": true,
141     "listeners": [
142       "Listener(@192.168.199.178:3332)"
143     ],
144     "peers": [
145       {
146         "node_info": {
147           "pub_key": "03571A5CE8B35E95E2357DB2823E9EB76EB42D5CCC5F8E68315388832878C011",
148           "moniker": "anonymous",
149           "network": "chain0",
150           "remote_addr": "127.0.0.1:51058",
151           "listen_addr": "192.168.199.178:3333",
152           "version": "0.1.0",
153           "other": [
154             "wire_version=0.6.2",
155             "p2p_version=0.5.0",
156             "rpc_addr=tcp://0.0.0.0:46658"
157           ]
158         },
159 ......
160 ```
161
162 ## Contributing
163
164 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!
165
166 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!
167
168 ## License
169
170 [AGPL v3](./LICENSE)