README.md 19.3 KB
Newer Older
D
Daniel Larimer 已提交
1
# EOS.IO - The Most Powerful Infrastructure for Decentralized Applications
N
Nathan Hourt 已提交
2

peterwillcn's avatar
peterwillcn 已提交
3 4
[![Build Status](https://travis-ci.org/EOSIO/eos.svg?branch=master)](https://travis-ci.org/EOSIO/eos)

D
Daniel Larimer 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Welcome to the EOS.IO source code repository!  EOS.IO software enables developers to create and deploy
high-performance, horizontally scalable, blockchain infrastructure upon which decentralized applications
can be built. 

This code is currently alpha-quality and under rapid development. That said,
there is plenty early experimenters can do including, running a private multi-node test network and
develop applications (smart contracts).  

# Resources
1. [EOS.IO Website](https://eos.io)
2. [Blog](https://steemit.com/@eosio)
2. [Roadmap](https://github.com/EOSIO/Documentation/blob/master/Roadmap.md)
3. [Telegram](https://eos.io/chat)
4. [Documentation](https://eosio.github.io/eos/)
5. [White Paper](https://github.com/EOSIO/Documentation/blob/master/TechnicalWhitePaper.md)
N
Nathan Hourt 已提交
20

21 22 23
# Table of contents

1. [Getting Started](#gettingstarted)
S
Serg Metelin 已提交
24
2. [Setting up a build/development environment](#setup)
25
	1. [Automated build script](#autobuild)
S
Serg Metelin 已提交
26
	    1. [Clean install Ubuntu 16.10](#autoubuntu)
27 28 29 30
	    2. [macOS Sierra 10.12.6](#automac)
	2. [Manual installation of the dependencies](#manualdep)
        1. [Clean install Ubuntu 16.10](#ubuntu)
        2. [macOS Sierra 10.12.6](#macos)
S
Serg Metelin 已提交
31
3. [Building EOS and running a node](#runanode)
32 33 34 35 36 37 38 39
	1. [Getting the code](#getcode)
	2. [Building from source code](#build)
	3. [Creating and launching a single-node testnet](#singlenode)
4. [Accounts and smart contracts](#accountssmartcontracts)
	1. [Example smart contracts](#smartcontractexample)
	2. [Setting up a wallet and importing account key](#walletimport)
	3. [Creating accounts for your smart contracts](#createaccounts)
	4. [Upload sample contract to blockchain](#uploadsmartcontract)
40
	5. [Pushing a message to a sample contract](#pushamessage)
41 42
	6. [Reading Currency Contract Balance](#readingcontract)
5. [Running local testnet](#localtestnet)
S
Serg Metelin 已提交
43 44
6. [Doxygen documentation](#doxygen)
7. [Running EOS in Docker](#docker)
45
	1. [Running contract in docker example](#dockercontract)
46

S
Serg Metelin 已提交
47 48
<a name="gettingstarted"></a>
## Getting Started
49
The following instructions overview the process of getting the software, building it, running a simple test network that produces blocks, account creation and uploading a sample contract to the blockchain.
N
Nathan Hourt 已提交
50

S
Serg Metelin 已提交
51 52
<a name="setup"></a>
## Setting up a build/development environment
53

54 55 56 57 58
<a name="autobuild"></a>
### Automated build script

For Ubuntu 16.10 and macOS Sierra, there is an automated build script that can install all dependencies and builds EOS.

59 60 61 62
Clone EOS repository recursively as below and run build.sh located in root `eos` folder.

<a name="autoubuntu"></a>
#### Clean install Ubuntu 16.10 
63 64 65 66 67

```bash
git clone https://github.com/eosio/eos --recursive

cd eos
68
./build.sh ubuntu 
69 70
```

71 72
Now you can proceed to the next step - [Creating and launching a single-node testnet](#singlenode)

73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
<a name="automac"></a>
#### macOS Sierra

Before running the script make sure you have updated XCode and brew:

```bash
xcode-select --install
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```

```bash
git clone https://github.com/eosio/eos --recursive

cd eos
./build.sh darwin
```

Now you can proceed to the next step - [Creating and launching a single-node testnet](#singlenode)

<a name="manualdep"></a>
### Manual installation of the dependencies

If you prefer to manually build dependencies - follow the steps below.
96

97 98 99 100 101 102 103 104 105 106 107
This project is written primarily in C++14 and uses CMake as its build system. An up-to-date Clang and the latest version of CMake is recommended.

Dependencies:

* Clang 4.0.0
* CMake 3.5.1
* Boost 1.64
* OpenSSL
* LLVM 4.0
* [secp256k1-zkp (Cryptonomex branch)](https://github.com/cryptonomex/secp256k1-zkp.git)
* [binaryen](https://github.com/WebAssembly/binaryen.git)
108

S
Serg Metelin 已提交
109
<a name="ubuntu"></a>
110
#### Clean install Ubuntu 16.10 
111 112 113

Install the development toolkit:

114
```bash
115
sudo apt-get update
116 117 118
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo apt-get install clang-4.0 lldb-4.0 cmake make \
                     libbz2-dev libssl-dev libgmp3-dev \
119
                     autotools-dev build-essential \
120
                     libbz2-dev libicu-dev python-dev \
121 122 123 124 125
                     autoconf libtool git
```

Install Boost 1.64:

126
```bash
127 128 129 130
cd ~
wget -c 'https://sourceforge.net/projects/boost/files/boost/1.64.0/boost_1_64_0.tar.bz2/download' -O boost_1.64.0.tar.bz2
tar xjf boost_1.64.0.tar.bz2
cd boost_1_64_0/
S
Serg Metelin 已提交
131 132
echo "export BOOST_ROOT=$HOME/opt/boost_1_64_0" >> ~/.bash_profile
source ~/.bash_profile
133 134
./bootstrap.sh "--prefix=$BOOST_ROOT"
./b2 install
S
Serg Metelin 已提交
135
source ~/.bash_profile
136 137
```

138 139
Install [secp256k1-zkp (Cryptonomex branch)](https://github.com/cryptonomex/secp256k1-zkp.git):
        
140
```bash
141 142 143 144 145 146 147 148 149
cd ~
git clone https://github.com/cryptonomex/secp256k1-zkp.git
cd secp256k1-zkp
./autogen.sh
./configure
make
sudo make install
```

150
To use the WASM compiler, EOS has an external dependency on [binaryen](https://github.com/WebAssembly/binaryen.git):
S
Serg Metelin 已提交
151

152
```bash
S
Serg Metelin 已提交
153 154 155 156 157 158 159 160
cd ~
git clone https://github.com/WebAssembly/binaryen.git
cd ~/binaryen
git checkout tags/1.37.14
cmake . && make

```

L
Liu-Cheng Xu 已提交
161
Add `BINARYEN_ROOT` to your .bash_profile:
S
Serg Metelin 已提交
162

163
```bash
S
Serg Metelin 已提交
164 165 166
echo "export BINARYEN_ROOT=~/binaryen" >> ~/.bash_profile
source ~/.bash_profile
```
D
Daniel Larimer 已提交
167

S
Serg Metelin 已提交
168
By default LLVM and clang do not include the WASM build target, so you will have to build it yourself:
169

170
```bash
171 172 173 174 175 176 177 178 179 180
mkdir  ~/wasm-compiler
cd ~/wasm-compiler
git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/llvm.git
cd llvm/tools
git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/clang.git
cd ..
mkdir build
cd build
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=.. -DLLVM_TARGETS_TO_BUILD= -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DCMAKE_BUILD_TYPE=Release ../
make -j4 install
181
```
182

S
Serg Metelin 已提交
183 184
Your environment is set up. Now you can <a href="#runanode">build EOS and run a node</a>. 

S
Serg Metelin 已提交
185
<a name="macos"></a>
186
#### macOS Sierra 10.12.6 
187 188

macOS additional Dependencies:
S
Serg Metelin 已提交
189

190 191 192 193 194
* Brew
* Newest XCode

Upgrade your XCode to the newest version:

195
```bash
196
xcode-select --install
197 198
```

199
Install homebrew:
200

201
```bash
202 203 204 205 206
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```

Install the dependencies:

207
```bash
208
brew update
S
Serg Metelin 已提交
209
brew install git automake libtool boost openssl llvm@4 gmp
210
```
211

212 213
Install [secp256k1-zkp (Cryptonomex branch)](https://github.com/cryptonomex/secp256k1-zkp.git):
        
214
```bash
215 216 217 218 219 220 221
cd ~
git clone https://github.com/cryptonomex/secp256k1-zkp.git
cd secp256k1-zkp
./autogen.sh
./configure
make
sudo make install
222
```
223

S
Serg Metelin 已提交
224 225
Install [binaryen v1.37.14](https://github.com/WebAssembly/binaryen.git):

226
```bash
S
Serg Metelin 已提交
227 228 229 230 231 232 233
cd ~
git clone https://github.com/WebAssembly/binaryen.git
cd ~/binaryen
git checkout tags/1.37.14
cmake . && make
```

L
Liu-Cheng Xu 已提交
234
Add `BINARYEN_ROOT` to your .bash_profile:
S
Serg Metelin 已提交
235

236
```bash
S
Serg Metelin 已提交
237 238 239 240 241
echo "export BINARYEN_ROOT=~/binaryen" >> ~/.bash_profile
source ~/.bash_profile
```


242 243
Build LLVM and clang for WASM:

244
```bash
245 246 247 248 249 250 251 252 253 254 255 256
mkdir  ~/wasm-compiler
cd ~/wasm-compiler
git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/llvm.git
cd llvm/tools
git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/clang.git
cd ..
mkdir build
cd build
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=.. -DLLVM_TARGETS_TO_BUILD= -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DCMAKE_BUILD_TYPE=Release ../
make -j4 install
```

S
Serg Metelin 已提交
257
Add `WASM_LLVM_CONFIG` and `LLVM_DIR` to your `.bash_profile`:
258

259
```bash
260 261
echo "export WASM_LLVM_CONFIG=~/wasm-compiler/llvm/bin/llvm-config" >> ~/.bash_profile
echo "export LLVM_DIR=/usr/local/Cellar/llvm/4.0.1/lib/cmake/llvm" >> ~/.bash_profile
S
Serg Metelin 已提交
262
source ~/.bash_profile
263 264
```

S
Serg Metelin 已提交
265
<a name="runanode"></a>
S
Serg Metelin 已提交
266
## Building EOS and running a node 
S
Serg Metelin 已提交
267

S
Serg Metelin 已提交
268 269
<a name="getcode"></a>
### Getting the code 
S
Serg Metelin 已提交
270

271
To download all of the code, download EOS source code and a recursion or two of submodules. The easiest way to get all of this is to do a recursive clone:
N
Nathan Hourt 已提交
272

273 274 275
```bash
git clone https://github.com/eosio/eos --recursive
```
N
Nathan Hourt 已提交
276 277 278

If a repo is cloned without the `--recursive` flag, the submodules can be retrieved after the fact by running this command from within the repo:

279 280 281
```bash
git submodule update --init --recursive
```
N
Nathan Hourt 已提交
282

S
Serg Metelin 已提交
283 284
<a name="build"></a>
### Building from source code 
285

286 287
The *WASM_LLVM_CONFIG* environment variable is used to find our recently built WASM compiler.
This is needed to compile the example contracts inside `eos/contracts` folder and their respective tests.
288

289
```bash
S
Serg Metelin 已提交
290
cd ~
291
git clone https://github.com/eosio/eos --recursive
S
Serg Metelin 已提交
292
mkdir -p ~/eos/build && cd ~/eos/build
J
jaehong park 已提交
293
cmake -DBINARYEN_BIN=~/binaryen/bin -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib ..
294 295 296 297
make -j4
```

Out-of-source builds are also supported. To override clang's default choice in compiler, add these flags to the CMake command:
N
Nathan Hourt 已提交
298 299 300 301 302

`-DCMAKE_CXX_COMPILER=/path/to/c++ -DCMAKE_C_COMPILER=/path/to/cc`

For a debug build, add `-DCMAKE_BUILD_TYPE=Debug`. Other common build types include `Release` and `RelWithDebInfo`.

303
To run the test suite after building, run the `chain_test` executable in the `tests` folder.
N
Nathan Hourt 已提交
304

S
Serg Metelin 已提交
305 306 307 308 309
EOS comes with a number of programs you can find in `~/eos/build/programs`. They are listed below:

* eosd - server-side blockchain node component
* eosc - command line interface to interact with the blockchain
* eos-walletd - EOS wallet
S
Serg Metelin 已提交
310
* launcher - application for nodes network composing and deployment; [more on launcher](https://github.com/EOSIO/eos/blob/master/testnet.md)
S
Serg Metelin 已提交
311

S
Serg Metelin 已提交
312 313
<a name="singlenode"></a>
### Creating and launching a single-node testnet 
S
Serg Metelin 已提交
314

L
Liu-Cheng Xu 已提交
315
After successfully building the project, the `eosd` binary should be present in the `programs/eosd` directory. Go ahead and run `eosd` -- it will probably exit with an error, but if not, close it immediately with <kbd>Ctrl-C</kbd>. Note that `eosd` created a directory named `data-dir` containing the default configuration (`config.ini`) and some other internals. This default data storage path can be overridden by passing `--data-dir /path/to/data` to `eosd`.
N
Nathan Hourt 已提交
316

N
Nathan Hourt 已提交
317
Edit the `config.ini` file, adding the following settings to the defaults already in place:
N
Nathan Hourt 已提交
318 319

```
N
Nathan Hourt 已提交
320 321 322 323 324
# Load the testnet genesis state, which creates some initial block producers with the default key
genesis-json = /path/to/eos/source/genesis.json
# Enable production on a stale chain, since a single-node test chain is pretty much always stale
enable-stale-production = true
# Enable block production with the testnet producers
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345
producer-name = inita
producer-name = initb
producer-name = initc
producer-name = initd
producer-name = inite
producer-name = initf
producer-name = initg
producer-name = inith
producer-name = initi
producer-name = initj
producer-name = initk
producer-name = initl
producer-name = initm
producer-name = initn
producer-name = inito
producer-name = initp
producer-name = initq
producer-name = initr
producer-name = inits
producer-name = initt
producer-name = initu
S
Serg Metelin 已提交
346
# Load the block producer plugin, so you can produce blocks
N
Nathan Hourt 已提交
347
plugin = eos::producer_plugin
S
Serg Metelin 已提交
348
# Wallet plugin
349
plugin = eos::wallet_api_plugin
S
Serg Metelin 已提交
350
# As well as API and HTTP plugins
351 352
plugin = eos::chain_api_plugin
plugin = eos::http_plugin
N
Nathan Hourt 已提交
353 354
```

355
Now it should be possible to run `eosd` and see it begin producing blocks.
peterwillcn's avatar
peterwillcn 已提交
356

S
Serg Metelin 已提交
357 358 359 360 361 362 363 364 365 366 367 368 369 370
When running `eosd` you should get log messages similar to below. It means the blocks are successfully produced.

```
1575001ms thread-0   chain_controller.cpp:235      _push_block          ] initm #1 @2017-09-04T04:26:15  | 0 trx, 0 pending, exectime_ms=0
1575001ms thread-0   producer_plugin.cpp:207       block_production_loo ] initm generated block #1 @ 2017-09-04T04:26:15 with 0 trxs  0 pending
1578001ms thread-0   chain_controller.cpp:235      _push_block          ] initc #2 @2017-09-04T04:26:18  | 0 trx, 0 pending, exectime_ms=0
1578001ms thread-0   producer_plugin.cpp:207       block_production_loo ] initc generated block #2 @ 2017-09-04T04:26:18 with 0 trxs  0 pending
1581001ms thread-0   chain_controller.cpp:235      _push_block          ] initd #3 @2017-09-04T04:26:21  | 0 trx, 0 pending, exectime_ms=0
1581001ms thread-0   producer_plugin.cpp:207       block_production_loo ] initd generated block #3 @ 2017-09-04T04:26:21 with 0 trxs  0 pending
1584000ms thread-0   chain_controller.cpp:235      _push_block          ] inite #4 @2017-09-04T04:26:24  | 0 trx, 0 pending, exectime_ms=0
1584000ms thread-0   producer_plugin.cpp:207       block_production_loo ] inite generated block #4 @ 2017-09-04T04:26:24 with 0 trxs  0 pending
1587000ms thread-0   chain_controller.cpp:235      _push_block          ] initf #5 @2017-09-04T04:26:27  | 0 trx, 0 pending, exectime_ms=0
```

S
Serg Metelin 已提交
371 372
<a name="accountssmartcontracts"></a>
## Accounts and smart contracts 
S
Serg Metelin 已提交
373

374
EOS comes with example contracts that can be uploaded and run for testing purposes. To upload and test them, follow the steps below.
S
Serg Metelin 已提交
375

S
Serg Metelin 已提交
376 377
<a name="smartcontractexample"></a>
### Example smart contracts 
378 379 380

To publish sample smart contracts you need to create accounts for them.

S
Serg Metelin 已提交
381 382
Run the node:

383
```bash
S
Serg Metelin 已提交
384
cd ~/eos/build/programs/eosd/
S
Serg Metelin 已提交
385
./eosd
S
Serg Metelin 已提交
386
```
387

S
Serg Metelin 已提交
388 389
<a name="walletimport"></a>
### Setting up a wallet and importing account key 
S
Serg Metelin 已提交
390

391
Before running API commands you need to import the private key of an account you will be authorizing the transactions under into the EOS wallet.
S
Serg Metelin 已提交
392

393
As you've previously added `plugin = eos::wallet_api_plugin` into `config.ini`, EOS wallet will be running as a part of `eosd` process.
S
Serg Metelin 已提交
394

395
For testing purposes you can use a pre-created account `inita` from the `genesis.json` file.
S
Serg Metelin 已提交
396 397 398

To login you need to run a command importing an active (not owner!) private key from `inita` account (you can find it in `~/eos/build/programs/eosd/data-dir/config.ini`) to the wallet.

399
```bash
S
Serg Metelin 已提交
400
cd ~/eos/build/programs/eosc/
401 402
./eosc wallet create # Outputs a password that you need to save to be able to lock/unlock the wallet
./eosc wallet import 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
S
Serg Metelin 已提交
403 404
```

405
Now you can issue API commands under `inita` authority.
S
Serg Metelin 已提交
406

S
Serg Metelin 已提交
407 408
<a name="createaccounts"></a>
### Creating accounts for your smart contracts 
S
Serg Metelin 已提交
409

410
First, generate public/private key pairs for the `owner_key` and `active_key`. You will need them to create an account:
411

412
```bash
413
cd ~/eos/build/programs/eosc/
414 415
./eosc create key # owner_key
./eosc create key # active_key
416 417 418 419 420 421 422 423 424
```

You will get two pairs of a public and private key:

```
Private key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Public key:  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
```

425
**Warning:**
426 427 428 429
Save the values for future reference.

Run `create` command where `PUBLIC_KEY_1` and `PUBLIC_KEY_2` are the values generated by the `create key` command:

430
```bash
431
./eosc create account inita currency PUBLIC_KEY_1 PUBLIC_KEY_2 
432 433 434 435
```

You should get a json response back with a transaction ID confirming it was executed successfully.

436 437
Check that account was successfully created: 

438
```bash
S
Serg Metelin 已提交
439
./eosc get account currency
440 441 442 443 444 445
```

You should get a response similar to this:

```json
{
S
Serg Metelin 已提交
446
  "name": "currency",
447 448 449 450 451 452 453
  "eos_balance": 0,
  "staked_balance": 1,
  "unstaking_balance": 0,
  "last_unstaking_time": "2106-02-07T06:28:15"
}
```

454 455 456 457 458 459
Now import the owner private key generated previously in the wallet:

```bash
./eosc wallet import XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
```

S
Serg Metelin 已提交
460 461
<a name="uploadsmartcontract"></a>
### Upload sample contract to blockchain 
462

463
Before uploading a contract, you can verify that there is no current contract:
D
Daniel Larimer 已提交
464

465
```bash
D
Daniel Larimer 已提交
466 467 468 469
./eosc get code currency 
code hash: 0000000000000000000000000000000000000000000000000000000000000000
```

470
With an account for a contract created, you can upload a sample contract:
471

472
```bash
473
./eosc set contract currency ../../contracts/currency/currency.wast ../../contracts/currency/currency.abi
S
Serg Metelin 已提交
474 475 476 477
```

As a response you should get a json with a `transaction_id` field. Your contract was successfully uploaded!

478
You can also verify that the code has been set:
D
Daniel Larimer 已提交
479

480
```bash
D
Daniel Larimer 已提交
481 482 483 484
./eosc get code currency
code hash: 9b9db1a7940503a88535517049e64467a6e8f4e9e03af15e9968ec89dd794975
```

485
Next you can verify that the currency contract has the proper initial balance:
D
Daniel Larimer 已提交
486

487
```bash
D
Daniel Larimer 已提交
488 489 490 491 492 493 494 495 496 497 498
./eosc get table currency currency account
{
  "rows": [{
     "account": "account",
     "balance": 1000000000
     }
  ],
  "more": false
}
```

S
Serg Metelin 已提交
499
<a name="pushamessage"></a>
500
### Pushing a message to a sample contract 
S
Serg Metelin 已提交
501

502
To send a message to a contract you need to create a new user account who will be sending the message.
S
Serg Metelin 已提交
503 504 505

Firstly, generate the keys for the account:

506
```bash
S
Serg Metelin 已提交
507 508 509
cd ~/eos/build/programs/eosc/
./eosc create key
./eosc create key
510 511
```

S
Serg Metelin 已提交
512 513
And then create the `tester` account:

514
```bash
515
./eosc create account inita tester PUBLIC_USER_KEY_1 PUBLIC_USER_KEY_2 
S
Serg Metelin 已提交
516 517
```

518
After this you can send a message to the contract:
S
Serg Metelin 已提交
519

520
```bash
521
./eosc push message currency transfer '{"from":"currency","to":"inita","amount":50}' --scope currency,inita --permission currency@active
D
Daniel Larimer 已提交
522 523 524 525
```

As a confirmation of a successfully submitted transaction you will get a json with a `transaction_id` field.

S
Serg Metelin 已提交
526
<a name="readingcontract"></a>
527 528
### Reading currency contract balance 

D
Daniel Larimer 已提交
529

530
```bash
D
Daniel Larimer 已提交
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548
./eosc get table inita currency account
{
  "rows": [{
      "account": "account",
      "balance": 50 
       }
    ],
  "more": false
}
./eosc get table currency currency account
{
  "rows": [{
      "account": "account",
      "balance": 999999950
    }
  ],
  "more": false
}
S
Serg Metelin 已提交
549 550
```

S
Serg Metelin 已提交
551 552
<a name="localtestnet"></a>
## Running local testnet 
S
Serg Metelin 已提交
553

S
Serg Metelin 已提交
554
To run a local testnet you can use a `launcher` application provided in `~/eos/build/programs/launcher` folder.
S
Serg Metelin 已提交
555

S
Serg Metelin 已提交
556
For testing purposes you will run 2 local production nodes talking to each other.
S
Serg Metelin 已提交
557

558
```bash
S
Serg Metelin 已提交
559 560
cd ~/eos/build
cp ../genesis.json ./
B
bitcoiners 已提交
561
./programs/launcher/launcher -p2 --skip-signature
S
Serg Metelin 已提交
562 563
```

564
This command will generate 2 data folders for each instance of the node: `tn_data_0` and `tn_data_1`.
S
Serg Metelin 已提交
565 566 567

You should see a following response:

568
```bash
S
Serg Metelin 已提交
569 570 571 572 573 574 575 576
adding hostname ip-XXX-XXX-XXX
found interface 127.0.0.1
found interface XXX.XX.XX.XX
spawning child, programs/eosd/eosd --skip-transaction-signatures --data-dir tn_data_0
spawning child, programs/eosd/eosd --skip-transaction-signatures --data-dir tn_data_1
```

To confirm the nodes are running, run following `eosc` commands:
577
```bash
S
Serg Metelin 已提交
578 579 580 581 582
~/eos/build/programs/eosc
./eosc -p 8888 get info
./eosc -p 8889 get info
```

S
Serg Metelin 已提交
583
For each you should get a json with a blockchain information.
S
Serg Metelin 已提交
584

S
Serg Metelin 已提交
585 586
You can read more on launcher and its settings [here](https://github.com/EOSIO/eos/blob/master/testnet.md)

S
Serg Metelin 已提交
587 588
<a name="doxygen"></a>
## Doxygen documentation 
S
Serg Metelin 已提交
589 590 591

You can find more detailed API documentation in Doxygen reference: https://eosio.github.io/eos/

S
Serg Metelin 已提交
592 593
<a name="docker"></a>
## Running EOS in Docker 
peterwillcn's avatar
peterwillcn 已提交
594

595
Simple and fast setup of EOS in Docker is also available. Firstly, install dependencies:
596

peterwillcn's avatar
peterwillcn 已提交
597 598 599 600
 - [Docker](https://docs.docker.com)
 - [Docker-compose](https://github.com/docker/compose)
 - [Docker-volumes](https://github.com/cpuguy83/docker-volumes)

L
Liu-Cheng Xu 已提交
601
Build eos image:
peterwillcn's avatar
peterwillcn 已提交
602 603


604
```bash
S
Serg Metelin 已提交
605 606 607 608
git clone https://github.com/EOSIO/eos.git --recursive
cd eos
cp genesis.json Docker 
docker build -t eosio/eos -f Docker/Dockerfile .
peterwillcn's avatar
peterwillcn 已提交
609 610
```

S
Serg Metelin 已提交
611 612
We recommend 6GB+ of memory allocated to Docker to successfully build the image.

S
Serg Metelin 已提交
613
Now you can start the Docker container:
peterwillcn's avatar
peterwillcn 已提交
614

615
```bash
peterwillcn's avatar
peterwillcn 已提交
616
sudo rm -rf /data/store/eos # options 
peterwillcn's avatar
peterwillcn 已提交
617
sudo mkdir -p /data/store/eos
S
Serg Metelin 已提交
618
docker-compose -f Docker/docker-compose.yml up
peterwillcn's avatar
peterwillcn 已提交
619 620
```

621
Get chain info:
622

623
```bash
624 625 626
curl http://127.0.0.1:8888/v1/chain/get_info
```

S
Serg Metelin 已提交
627
<a name="dockercontract"></a>
628
### Running contract in docker example 
S
Serg Metelin 已提交
629

630
You can run the `eosc` commands via `docker exec` command. For example:
S
Serg Metelin 已提交
631

632
```bash
633
docker exec docker_eos_1 eosc set contract exchange build/contracts/exchange/exchange.wast build/contracts/exchange/exchange.abi
634
```