OSDN Git Service

Update README.md
[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 ```bash
80 $ ./bytomcli create-key account_name password   # Create an account named account_name using password
81 $ ./bytomcli delete-key password pubkey         # Delete account pubkey
82 $ ./bytomcli reset-password oldpassword newpassword pubkey  # Update password
83 ```
84
85 ### Create and launch a single node
86
87 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:
88
89 ```bash
90 $ cd ./cmd/bytom
91 $ ./bytom init --home ./.bytom
92 ```
93
94 After that, you'll see `.bytom` generated in current directory, then launch the single node:
95
96 ``` bash
97 $ ./bytom node --home ./.bytom
98 ```
99
100 #### Asset issuance test
101
102 Given the `bytom` node is running, you can use the provoided `issue-test` to test the asset issuance functionality:
103
104 ```bash
105 $ cd ./cmd/bytomcli
106 $ ./bytomcli issue-test
107 ```
108
109 ### Multiple node
110
111 Get the submodule depenency for multi-node test:
112
113 ```bash
114 $ git submodule update --init --recursive
115 ```
116
117 Create the first node `bytom0` and second node `bytom1`:
118
119 ```bash
120 $ cd cmd/bytom/2node-test
121 $ ./test.sh bytom0  # Start the first node
122 $ ./test.sh bytom1  # Start the second node
123 ```
124
125 Then we have two nodes:
126
127 ```bash
128 $ curl -X POST --data '{"jsonrpc":"2.0", "method": "net_info", "params":[], "id":"67"}' http://127.0.0.1:46657
129 ```
130
131 If everything goes well, we'll see the following response:
132
133 ```bash
134 {
135   "jsonrpc": "2.0",
136   "id": "67",
137   "result": {
138     "listening": true,
139     "listeners": [
140       "Listener(@192.168.199.178:3332)"
141     ],
142     "peers": [
143       {
144         "node_info": {
145           "pub_key": "03571A5CE8B35E95E2357DB2823E9EB76EB42D5CCC5F8E68315388832878C011",
146           "moniker": "anonymous",
147           "network": "chain0",
148           "remote_addr": "127.0.0.1:51058",
149           "listen_addr": "192.168.199.178:3333",
150           "version": "0.1.0",
151           "other": [
152             "wire_version=0.6.2",
153             "p2p_version=0.5.0",
154             "rpc_addr=tcp://0.0.0.0:46658"
155           ]
156         },
157 ......
158 ```
159
160 ## Contributing
161
162 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!
163
164 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!
165
166 ## License
167
168 [AGPL v3](./LICENSE)