OSDN Git Service

update readme
[bytom/vapor.git] / README.md
1 Vapor
2 ======
3
4 [![Build Status](https://travis-ci.org/Bytom/vapor.svg)](https://travis-ci.org/Bytom/vapor) [![AGPL v3](https://img.shields.io/badge/license-AGPL%20v3-brightgreen.svg)](./LICENSE)
5
6 **Golang implemented sidechain for Bytom.**
7
8 ## Requirements
9
10 - [Go](https://golang.org/doc/install) version 1.8 or higher, with `$GOPATH` set to your preferred directory
11
12 ## Get source code
13
14 ```
15 $ git clone https://github.com/Bytom/vapor.git $GOPATH/src/github.com/vapor
16 ```
17
18 Then, you have two ways to get vapor executable file:
19
20 1. compile source code
21 2. build it using Docker
22
23 ## Installation
24
25 ```
26 $ cd $GOPATH/src/github.com/vapor
27 $ make install
28 ```
29
30 ## Run
31
32 Firstly, you need initialize node:
33
34 ```
35 $ bytomd init --chain_id=vapor --home <vapor-data-path>
36 ```
37
38 For example, you can store vapor data in `$HOME/bytom/vapor`:
39
40 ```
41 $ bytomd init --chain_id=vapor --home $HOME/bytom/vapor
42 ```
43
44 And some files in `<vapor-data-path>`:
45
46 ```
47 $ cd <vapor-data-path>
48 $ tree -L 1
49 .
50 ├── LOCK
51 ├── config.toml
52 ├── data
53 ├── federation.json
54 ├── keystore
55 └── node_key.txt
56 ```
57
58 `config.toml` save vapor network info, like:
59
60 ```
61 $ cat config.toml
62 # This is a TOML config file.
63 # For more information, see https://github.com/toml-lang/toml
64 fast_sync = true
65 db_backend = "leveldb"
66 api_addr = "0.0.0.0:9889"
67 moniker = ""
68 chain_id = "vapor"
69 [p2p]
70 laddr = "tcp://0.0.0.0:56659"
71 seeds = "52.83.133.152:56659"
72 ```
73
74 `federation.json` save relayed node xpub, like:
75
76 ```
77 $ cat federation.json
78 {
79   "xpubs": [
80     "50ef22b3a3fca7bc08916187cc9ec2f4005c9c6b1353aa1decbd4be3f3bb0fbe1967589f0d9dec13a388c0412002d2c267bdf3b920864e1ddc50581be5604ce1"
81   ],
82   "quorum": 1
83 }
84 ```
85
86 Then, start your node:
87
88 ```
89 $ bytomd node --home <vapor-data-path>
90 ```
91
92 Solonet mode:
93
94 ```
95 $ bytomd init --chain_id=solonet --home <vapor-data-path>
96 $ bytomd node --home <vapor-data-path>
97 ```
98
99 ## Running in Docker
100
101 ### Build the image
102
103 ```
104 $ cd $GOPATH/src/github.com/vapor
105 $ docker build -t vapor .
106 ```
107
108 ### Enter the iterative mode
109
110 ```
111 $ docker run -it --net=host -v <vapor/data/directory/on/host/machine>:/root/.vapor vapor:latest
112 ```
113
114 vapor data directory has three config files:
115
116 - `config.toml`
117 - `federation.json`
118 - `node_key.txt`
119
120 Then you can use bytomd and bytomcli following [Bytom Wiki](https://github.com/Bytom/bytom/wiki/Command-Line-Options).
121
122 Use `exit` to exit Docker's iterative mode.
123
124 ### Daemon mode
125
126 For example,
127
128 ```bash
129 $ docker run -d --net=host -v <vapor/data/directory/on/host/machine>:/root/.vapor vapor:latest bytomd node --web.closed --auth.disable
130 ```
131
132 To list the running containners and check their container id, image, corresponding command, created time, status, name and ports being used:
133
134 ```
135 $ docker container ls
136 ```
137
138 or
139
140 ```
141 $ docker ps
142 ```
143
144 To execute a command inside a containner, for example:
145
146 ```
147 $ docker exec -it <containerId> bytomcli create-access-token <tokenId>
148 ```
149
150 To stop a running containner:
151
152 ```
153 $ docker stop <containerId>
154 ```
155
156 To remove a containner:
157
158 ```
159 $ docker rm <containerId>
160 ```
161
162 ## License
163
164 [AGPL v3](./LICENSE)