Vapor
-====
+======
-[![Build Status](https://travis-ci.org/Bytom/bytom.svg)](https://travis-ci.org/Bytom/vapor) [![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)
**Golang implemented sidechain for Bytom.**
-## What is Vapor?
+## Requirements
-Vapor is software designed to extensions to the Bytom protocol, which allows partipicants to define, issue and transfer digitial assets on a multi-asset shared ledger or networks pegged to Bytom as a sidechain or run as a standalone blockchain.
+- [Go](https://golang.org/doc/install) version 1.11 or higher, with `$GOPATH` set to your preferred directory
+## Get source code
-## Building from source
+```
+$ git clone https://github.com/Bytom/vapor.git $GOPATH/src/github.com/vapor
+```
-### Requirements
+Then, you have two ways to get vapor executable file:
-- [Go](https://golang.org/doc/install) version 1.11.4 or higher, with `$GOPATH` set to your preferred directory
+1. compile source code
+2. build it using Docker
-### Installation
+## Installation
-Ensure Go with the supported version is installed properly:
+```
+$ cd $GOPATH/src/github.com/vapor
+$ make install
+```
-```bash
-$ go version
-$ go env GOROOT GOPATH
+## Run Directly
+
+Firstly, you need initialize node:
+
+```
+$ vapord init --chain_id=mainnet --home <vapor-data-path>
```
-- Get the source code
+The default vapor data path (on the host) is:
++ Mac: `~/Library/Application Support/Vapor`
++ Linux: `~/.vapor`
++ Windows: `%APPDATA%\Vapor`
-``` bash
-$ git clone https://github.com/bytom/vapor.git $GOPATH/src/github.com/vapor
+Then, start your node:
+
+```
+$ vapord node --home <vapor-data-path>
```
-- Build source code
+## Running in Docker
-``` bash
+### Build the image
+
+```
$ cd $GOPATH/src/github.com/vapor
-$ make vapor # build vapor
-$ make vaporcli # build vaporcli
+$ docker build -t vapor .
```
-When successfully building the project, the `vapor` and `vaporcli` binary should be present in `cmd/vapor` and `cmd/vaporcli` directory, respectively.
-
-### Executables
+### Enter the iterative mode
-The Vapor project comes with several executables found in the `cmd` directory.
+```
+$ docker run -it --net=host -v <vapor/data/directory/on/host/machine>:/root/.vapor vapor:latest
+```
-| Command | Description |
-| ------------ | ------------------------------------------------------------ |
-| **vapor** | vapor command can help to initialize and launch vapor domain by custom parameters. `vapor --help` for command line options. |
-| **vaporcli** | Our main Vapor CLI client. It is the entry point into the Vapor 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 Vapor network via JSON RPC endpoints exposed on top of HTTP, WebSocket and/or IPC transports. `vaporcli --help`. |
+vapor data directory has three config files:
-## Running vapor
+- `config.toml`
+- `federation.json`
+- `node_key.txt`
-Currently, vapor 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 `vapor`. This section won't cover all the commands of `vapor` and `vaporcli` at length, for more information, please the help of every command, e.g., `vaporcli help`.
+Use `exit` to exit Docker's iterative mode.
-### Initialize
+### Daemon mode
-First of all, initialize the node:
+For example,
```bash
-$ cd ./cmd/vapor
-$ ./vapor init --chain_id mainnet
+$ docker run -d --net=host -v <vapor/data/directory/on/host/machine>:/root/.vapor vapor:latest vapord node --web.closed --auth.disable
```
-There are three options for the flag `--chain_id`:
+To list the running containners and check their container id, image, corresponding command, created time, status, name and ports being used:
-- `mainnet`: connect to the mainnet.
-- `testnet`: connect to the testnet wisdom.
-- `solonet`: standalone mode.
-
-After that, you'll see `config.toml` generated, then launch the node.
+```
+$ docker container ls
+```
-### launch
+or
-``` bash
-$ ./vapor node
+```
+$ docker ps
```
-available flags for `vapor node`:
+To execute a command inside a containner, for example:
```
- --auth.disable Disable rpc access authenticate
- --chain_id string Select network type
- -h, --help help for node
- --log_file string Log output file
- --log_level string Select log level(debug, info, warn, error or fatal
- --mainchain.mainchain_rpc_host string The address which the daemon will try to connect to validate peg-ins, if enabled. (default "127.0.0.1")
- --mainchain.mainchain_rpc_port string The port which the daemon will try to connect to validate peg-ins, if enabled. (default "9888")
- --mainchain.mainchain_token string The rpc token that the daemon will use to connect to validate peg-ins, if enabled.
- --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. (0.0.0.0:0 means any interface, any port) (default "tcp://0.0.0.0:46656")
- --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
- --side.fedpeg_xpubs string Change federated peg to use a different xpub.
- --side.parent_genesis_block_hash string (default "a75483474799ea1aa6bb910a1a5025b4372bf20bef20f246a2c2dc5e12e8a053")
- --side.pegin_confirmation_depth uint Pegin claims must be this deep to be considered valid. (default: 6) (default 6)
- --side.sign_block_xpubs string Change federated peg to use a different xpub.
- --signer string The signer corresponds to xpub of signblock
- --validate_pegin Validate pegin claims. All functionaries must run this.
- --vault_mode Run in the offline enviroment
- --wallet.disable Disable wallet
- --wallet.rescan Rescan wallet
- --web.closed Lanch web browser or not
-
+$ docker exec -it <containerId> vaporcli create-access-token <tokenId>
```
-Given the `vapor` node is running, the general workflow is as follows:
+To stop a running containner:
-- create key, then you can create account.
-- send transaction, i.e., build, sign and submit transaction.
-- query all kinds of information, let's say, avaliable key, account, key, balances, transactions, etc.
-
-### Dashboard
+```
+$ docker stop <containerId>
+```
-Access the dashboard:
+To remove a containner:
```
-$ open http://localhost:8888/
+$ docker rm <containerId>
```
-### Sidechain
+### Reward distribution tool
+
+After the supernode and alternative node receive the reward from the node, they will allocate the reward
+
+according to the interest rate.
+
+The reward calculation rules:
+
+ calculate the reward (consensus reward * interest rate * voting weight) according to the weight of votes
-* [Sidechain deployment](docs/vapor-deployment.md)
+cast in consensus around, and choose how many rounds of consensus to allocate the reward flexibly.
-## Contributing
+[Tool usage details](./cmd/votereward/README.md)
-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!
-If you run into an issue, feel free to [vapor issues](https://github.com/bytom/vapor/issues/) in this repository. We are glad to help!
+### Merger utxo
+UTXO has been merged to solve the problem that too much UTXO input causes a failed send transaction to fail.
+[details](./cmd/utxomerge/README.md)
## License