Skip to content

Commit 20757b7

Browse files
Seonpyo Kimmergify[bot]
authored andcommitted
Move setup part from docs to README.md
1 parent 8e5bdc8 commit 20757b7

File tree

2 files changed

+91
-103
lines changed

2 files changed

+91
-103
lines changed

README.md

Lines changed: 91 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,107 @@ CodeChain is a programmable open source blockchain technology optimal for develo
77

88
Download CodeChain code
99

10-
```
10+
```sh
1111
git clone git@github.com:CodeChain-io/codechain.git
1212
cd codechain
1313
```
1414

1515
Build in release mode
1616

17-
```
17+
```sh
1818
cargo build --release
1919
```
2020

2121
This will produce an executable in the `./target/release` directory.
2222

23+
##Setup
24+
25+
###Using Docker
26+
27+
CodeChain supports the use of Docker to provide an easy and seamless installation process by providing a single package that gives the user everything he/she
28+
needs to get CodeChain up and running. In order to get the installation package, run the following command after installing Docker:
29+
30+
```sh
31+
docker build -f docker/ubuntu/Dockerfile --tag codechain-io/codechain:branch_or_tag_name .
32+
```
33+
34+
WSL users may find difficulty in using Docker, and thus, it is highly recommended to use Ubuntu, or install Docker for Windows. When using Docker for Windows,
35+
it is necessary to enable Hyper-V in BIOS settings.
36+
37+
To see the Docker images created, run the following:
38+
```sh
39+
docker images
40+
```
41+
42+
It will result in something like this:
43+
```sh
44+
REPOSITORY TAG IMAGE ID CREATED SIZE
45+
codechain-io/codechain branch_or_tag_name 6f8474d9bc7a About a minute ago 1.85GB
46+
ubuntu 14.04 971bb384a50a 6 days ago 188MB
47+
```
48+
49+
If you want to run the first image file, run the following command:
50+
```sh
51+
docker run -it codechain-io/codechain:branch_or_tag_name
52+
```
53+
54+
This should result in CodeChain running.
55+
56+
###Building From Source
57+
58+
####Build Dependencies
59+
CodeChain requires Rust version 1.32.0 to build. Using [rustup](https://rustup.rs/ "rustup URL") is recommended.
60+
61+
- For Linux Systems:
62+
- Ubuntu
63+
64+
> `gcc`, `g++` and `make` are required for installing packages.
65+
```sh
66+
$ curl https://sh.rustup.rs -sSf | sh
67+
```
68+
69+
70+
- For Mac Systems:
71+
- MacOS 10.13.2 (17C88) tested
72+
> `clang` is required for installing packages.
73+
74+
```sh
75+
$ curl https://sh.rustup.rs -sSf | sh
76+
```
77+
78+
79+
- For Windows Systems:
80+
- Currently not supported for Windows. If on a Windows system, please install [WSL](https://docs.microsoft.com/en-us/windows/wsl/install-win10) to continue as Ubuntu.
81+
82+
Please make sure that all of the binaries above are included in your `PATH`. These conditions must be fulfilled before building CodeChain from source.
83+
84+
85+
Download CodeChain's source code and go into its directory.
86+
```sh
87+
git clone git@github.com:CodeChain-io/codechain.git
88+
cd codechain
89+
```
90+
91+
####Build as Release Version
92+
```sh
93+
cargo build --release
94+
```
95+
96+
This will produce an executable in the ./target/release directory.
97+
98+
###Using CodeChain SDK
99+
100+
Before starting to use the CodeChain SDK, please install node.js by going to this [page](https://nodejs.org/en/).
101+
102+
Next, install the package with the following command:
103+
104+
`npm install codechain-sdk` or `yarn add codechain-sdk`
105+
23106
## Run
24107
25108
To run CodeChain, just run
26109
27-
```
110+
```sh
28111
./target/release/codechain -c solo
29112
```
30113
You can create a block by sending a parcel through [JSON-RPC](https://github.com/CodeChain-io/codechain/blob/master/spec/JSON-RPC.md) or [JavaScript SDK](https://api.codechain.io/).
@@ -34,14 +117,14 @@ You can create a block by sending a parcel through [JSON-RPC](https://github.com
34117
35118
Make sure you run `rustfmt` before creating a PR to the repo. You need to install the nightly-2018-12-06 version of `rustfmt`.
36119
37-
```
120+
```sh
38121
rustup toolchain install nightly-2018-12-06
39122
rustup component add rustfmt-preview --toolchain nightly-2018-12-06
40123
```
41124
42125
To run `rustfmt`,
43126
44-
```
127+
```sh
45128
cargo +nightly-2018-12-06 fmt
46129
```
47130
@@ -52,14 +135,14 @@ You can see [the clippy document](https://rust-lang.github.io/rust-clippy/master
52135
You need to install the nightly-2018-12-06 version of `clippy`.
53136
54137
### Install
55-
```
138+
```sh
56139
rustup toolchain install nightly-2018-12-06
57140
rustup component add clippy-preview --toolchain nightly-2018-12-06
58141
```
59142
60143
### Run
61144
62-
```
145+
```sh
63146
cargo +nightly-2018-12-06 clippy --all --all-targets
64147
```
65148
@@ -70,7 +153,7 @@ Developers are strongly encouraged to write unit tests for new code, and to subm
70153
## User Manual
71154
72155
Under `docs` folder, run following command.
73-
```
156+
```sh
74157
make html
75158
```
76159
User manual will be generated at `docs/_build/html`.

docs/setup.rst

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)