-Bytom
+Vapor
======
-[![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)
+[![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)
-**Official golang implementation of the Bytom protocol.**
+**Golang implemented sidechain for Bytom.**
-Automated builds are available for stable releases and the unstable master branch. Binary archives are published at https://github.com/Bytom/bytom/releases.
+## Requirements
-## What is Bytom?
-
-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.
-
-In the current state `bytom` is able to:
-
-- Manage key, account as well as asset
-- Send transactions, i.e., issue, spend and retire asset
+- [Go](https://golang.org/doc/install) version 1.8 or higher, with `$GOPATH` set to your preferred directory
-## Installing with Homebrew
+## Get source code
```
-brew tap bytom/bytom && brew install bytom
+$ git clone https://github.com/Bytom/vapor.git $GOPATH/src/github.com/vapor
```
-## Building from source
-
-### Requirements
+Then, you have two ways to get vapor executable file:
-- [Go](https://golang.org/doc/install) version 1.8 or higher, with `$GOPATH` set to your preferred directory
-
-### Installation
+1. compile source code
+2. build it using Docker
-Ensure Go with the supported version is installed properly:
+## Installation
-```bash
-$ go version
-$ go env GOROOT GOPATH
```
+$ cd $GOPATH/src/github.com/vapor
+$ make install
+```
+
+## Run
-- Get the source code
+Firstly, you need initialize node:
-``` bash
-$ git clone https://github.com/Bytom/bytom.git $GOPATH/src/github.com/bytom
+```
+$ bytomd init --chain_id=vapor --home <vapor-data-path>
```
-- Build source code
+For example, you can store vapor data in `$HOME/bytom/vapor`:
-``` bash
-$ cd $GOPATH/src/github.com/bytom
-$ make bytomd # build bytomd
-$ make bytomcli # build bytomcli
+```
+$ bytomd init --chain_id=vapor --home $HOME/bytom/vapor
```
-When successfully building the project, the `bytom` and `bytomcli` binary should be present in `cmd/bytomd` and `cmd/bytomcli` directory, respectively.
-
-### Executables
+And some files in `<vapor-data-path>`:
-The Bytom project comes with several executables found in the `cmd` directory.
+```
+$ cd <vapor-data-path>
+$ tree -L 1
+.
+├── LOCK
+├── config.toml
+├── data
+├── federation.json
+├── keystore
+└── node_key.txt
+```
-| Command | Description |
-| ------------ | ------------------------------------------------------------ |
-| **bytomd** | bytomd command can help to initialize and launch bytom domain by custom parameters. `bytomd --help` for command line options. |
-| **bytomcli** | Our main Bytom CLI client. It is the entry point into the Bytom network (main-, test- or private net), capable of running as a full node archive node (retaining all historical state). It can be used by other processes as a gateway into the Bytom network via JSON RPC endpoints exposed on top of HTTP, WebSocket and/or IPC transports. `bytomcli --help` and the [bytomcli Wiki page](https://github.com/Bytom/bytom/wiki/Command-Line-Options) for command line options. |
+`config.toml` save vapor network info, like:
-## Running bytom
+```
+$ cat config.toml
+# This is a TOML config file.
+# For more information, see https://github.com/toml-lang/toml
+fast_sync = true
+db_backend = "leveldb"
+api_addr = "0.0.0.0:9889"
+moniker = ""
+chain_id = "vapor"
+[p2p]
+laddr = "tcp://0.0.0.0:56659"
+seeds = "52.83.133.152:56659"
+```
-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`.
+`federation.json` save relayed node xpub, like:
-### Initialize
+```
+$ cat federation.json
+{
+ "xpubs": [
+ "50ef22b3a3fca7bc08916187cc9ec2f4005c9c6b1353aa1decbd4be3f3bb0fbe1967589f0d9dec13a388c0412002d2c267bdf3b920864e1ddc50581be5604ce1"
+ ],
+ "quorum": 1
+}
+```
-First of all, initialize the node:
+Then, start your node:
-```bash
-$ cd ./cmd/bytomd
-$ ./bytomd init --chain_id mainnet
+```
+$ bytomd node --home <vapor-data-path>
```
-There are three options for the flag `--chain_id`:
+Solonet mode:
-- `mainnet`: connect to the mainnet.
-- `testnet`: connect to the testnet wisdom.
-- `solonet`: standalone mode.
+```
+$ bytomd init --chain_id=solonet --home <vapor-data-path>
+$ bytomd node --home <vapor-data-path>
+```
-After that, you'll see `config.toml` generated, then launch the node.
+## Running in Docker
-### launch
+### Build the image
-``` bash
-$ ./bytomd node
+```
+$ cd $GOPATH/src/github.com/vapor
+$ docker build -t vapor .
```
-available flags for `bytomd node`:
+### Enter the iterative mode
```
- --auth.disable Disable rpc access authenticate
- --chain_id string Select network type
- -h, --help help for node
- --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 (default true)
- --p2p.seeds string Comma delimited host:port seed nodes
- --p2p.skip_upnp Skip UPNP configuration
- --prof_laddr string Use http to profile bytomd programs
- --vault_mode Run in the offline enviroment
- --wallet.disable Disable wallet
- --wallet.rescan Rescan wallet
- --web.closed Lanch web browser or not
- --simd.enable Enable the _simd_ feature to speed up the _PoW_ verification (e.g., during mining and block verification)
+$ docker run -it --net=host -v <vapor/data/directory/on/host/machine>:/root/.vapor vapor:latest
```
-Given the `bytomd` node is running, the general workflow is as follows:
+vapor data directory has three config files:
-- 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.
+- `config.toml`
+- `federation.json`
+- `node_key.txt`
-__simd feature:__
+Then you can use bytomd and bytomcli following [Bytom Wiki](https://github.com/Bytom/bytom/wiki/Command-Line-Options).
-You could enable the _simd_ feature to speed up the _PoW_ verification (e.g., during mining and block verification) by simply:
-```
-bytomd node --simd.enable
-```
+Use `exit` to exit Docker's iterative mode.
-To enable this feature you will need to compile from the source code by yourself, and `make bytomd-simd`.
+### Daemon mode
-What is more,
+For example,
-+ if you are using _Mac_, please make sure _llvm_ is installed by `brew install llvm`.
-+ if you are using _Windows_, please make sure _mingw-w64_ is installed and set up the _PATH_ environment variable accordingly.
+```bash
+$ docker run -d --net=host -v <vapor/data/directory/on/host/machine>:/root/.vapor vapor:latest bytomd node --web.closed --auth.disable
+```
-For more details about using `bytomcli` command please refer to [API Reference](https://github.com/Bytom/bytom/wiki/API-Reference)
+To list the running containners and check their container id, image, corresponding command, created time, status, name and ports being used:
-### Dashboard
+```
+$ docker container ls
+```
-Access the dashboard:
+or
```
-$ open http://localhost:9889/
+$ docker ps
```
-### In Docker
-
-Ensure your [Docker](https://www.docker.com/) version is 17.05 or higher.
+To execute a command inside a containner, for example:
-```bash
-$ docker build -t bytom .
+```
+$ docker exec -it <containerId> bytomcli create-access-token <tokenId>
```
-For the usage please refer to [running-in-docker-wiki](https://github.com/Bytom/bytom/wiki/Running-in-Docker).
+To stop a running containner:
-## Contributing
+```
+$ docker stop <containerId>
+```
-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!
+To remove a containner:
-If you run into an issue, feel free to [bytom issues](https://github.com/Bytom/bytom/issues/) in this repository. We are glad to help!
+```
+$ docker rm <containerId>
+```
## License