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

3
[![Build Status](https://jenkins.eos.io/buildStatus/icon?job=eosio/master)](https://jenkins.eos.io/job/eosio/job/master/)
peterwillcn's avatar
peterwillcn 已提交
4

D
Daniel Larimer 已提交
5 6
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
7
can be built.
D
Daniel Larimer 已提交
8 9

This code is currently alpha-quality and under rapid development. That said,
10 11
there is plenty early experimenters can do including running a private multi-node test network and
developing applications (smart contracts).
D
Daniel Larimer 已提交
12

13 14
The public testnet described in the [wiki](https://github.com/EOSIO/eos/wiki/Testnet%3A%20Public) is running the `dawn-2.x` branch.  The `master` branch is no longer compatible with the public testnet.  Instructions are provided below for building either option.

15 16
### Supported Operating Systems
EOS.IO currently supports the following operating systems:  
17
1. Amazon 2017.09 and higher.  
18 19 20 21 22
2. Centos 7.  
3. Fedora 25 and higher (Fedora 27 recommended).  
4. Mint 18.  
5. Ubuntu 16.04 (Ubuntu 16.10 recommended).  
6. MacOS Darwin 10.12 and higher (MacOS 10.13.x recommended).  
23

D
Daniel Larimer 已提交
24 25
# Resources
1. [EOS.IO Website](https://eos.io)
26 27
2. [Documentation](https://eosio.github.io/eos/)
3. [Blog](https://steemit.com/@eosio)
S
Sandwich 已提交
28
4. [Community Telegram Group](https://t.me/EOSProject)
29 30 31
5. [Developer Telegram Group](https://t.me/joinchat/EaEnSUPktgfoI-XPfMYtcQ)
6. [White Paper](https://github.com/EOSIO/Documentation/blob/master/TechnicalWhitePaper.md)
7. [Roadmap](https://github.com/EOSIO/Documentation/blob/master/Roadmap.md)
J
Jonathan Giszczak 已提交
32
8. [Wiki](https://github.com/EOSIO/eos/wiki)
N
Nathan Hourt 已提交
33

34 35 36
# Table of contents

1. [Getting Started](#gettingstarted)
S
Serg Metelin 已提交
37
2. [Setting up a build/development environment](#setup)
38
	1. [Automated build script](#autobuild)
39 40
      1. [Clean install Linux (Amazon, Centos, Fedora, Mint, & Ubuntu) for a local testnet](#autoubuntulocal)
      2. [Clean install Linux (Amazon, Centos, Fedora, Mint, & Ubuntu) for the public testnet](#autoubuntupublic)
41 42
      3. [MacOS for a local testnet](#automaclocal)
      4. [MacOS for the public testnet](#automacpublic)
S
Serg Metelin 已提交
43
3. [Building EOS and running a node](#runanode)
44 45 46
	1. [Getting the code](#getcode)
	2. [Building from source code](#build)
	3. [Creating and launching a single-node testnet](#singlenode)
J
Jonathan Giszczak 已提交
47
  4. [Next steps](#nextsteps)
S
Sandwich 已提交
48 49
4. [Example Currency Contract Walkthrough](#smartcontracts)
	1. [Example Contracts](#smartcontractexample)
50 51 52
	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)
53
	5. [Pushing a message to a sample contract](#pushamessage)
54 55
	6. [Reading Currency Contract Balance](#readingcontract)
5. [Running local testnet](#localtestnet)
56 57 58 59
6. [Running a node on the public testnet](#publictestnet)
7. [Doxygen documentation](#doxygen)
8. [Running EOS in Docker](#docker)
9. [Manual installation of the dependencies](#manualdep)
60
   1. [Clean install Amazon 2017.09 and higher](#manualdepamazon)
61 62
   2. [Clean install Centos 7 and higher](#manualdepcentos)
   3. [Clean install Fedora 25 and higher](#manualdepfedora)
63 64
   4. [Clean install Mint 18](#manualdepubuntu)
   4. [Clean install Ubuntu 16](#manualdepubuntu)
65
   5. [Clean install MacOS Sierra 10.12 and higher](#manualdepmacos)
66

S
Serg Metelin 已提交
67 68
<a name="gettingstarted"></a>
## Getting Started
69
The following instructions detail 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 已提交
70

S
Serg Metelin 已提交
71 72
<a name="setup"></a>
## Setting up a build/development environment
73

74 75 76
<a name="autobuild"></a>
### Automated build script

P
pacificcode 已提交
77
Supported Operating Systems:  
78
1. Amazon 2017.09 and higher.  
79
2. Centos 7.  
80
3. Fedora 25 and higher (Fedora 27 recommended).  
81
4. Mint 18.  
82
5. Ubuntu 16.04 (Ubuntu 16.10 recommended).  
83
6. MacOS Darwin 10.12 and higher (MacOS 10.13.x recommended).  
84

85
For Amazon, Centos, Fedora, Mint, Ubuntu, & MacOS there is an automated build script that can install all dependencies and builds EOS.
86
We are working on supporting other Linux/Unix distributions in future releases.
87

88
Choose whether you will be building for a local testnet or for the public testnet and jump to the appropriate section below.  Clone the EOS repository recursively as described and run eosio_build.sh located in the root `eos` folder.
89

90 91
:warning: **As of February 2018, `master` is under heavy development and is not suitable for experimentation.** :warning:

92
We strongly recommend following the instructions for building the public testnet version for [Linux](#autoubuntupublic) or [Mac OS X](#automacpublic). `master` is in pieces on the garage floor while we rebuild this hotrod. This notice will be removed when `master` is usable again. Your patience is appreciated.
93

94
<a name="autoubuntulocal"></a>
95
#### :no_entry: Clean install Linux (Amazon, Centos, Fedora, Mint, & Ubuntu) for a local testnet :no_entry:
96 97 98 99

```bash
git clone https://github.com/eosio/eos --recursive
cd eos
100
./eosio_build.sh
101 102
```

J
Jonathan Giszczak 已提交
103 104 105 106 107 108
For ease of contract development, one further step is required:

```bash
sudo make install
```

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

111
<a name="autoubuntupublic"></a>
112
#### Clean install Linux (Amazon, Centos, Fedora, Mint, & Ubuntu) for the public testnet
113

114 115 116
```bash
git clone https://github.com/eosio/eos --recursive
cd eos
117 118 119
git checkout DAWN-2018-02-14
git submodule update --recursive
./build.sh
120 121
```

J
Jonathan Giszczak 已提交
122 123 124 125 126 127
For ease of contract development, one further step is required:

```bash
sudo make install
```

128 129 130
Now you can proceed to the next step - [Running a node on the public testnet](#publictestnet)

<a name="automaclocal"></a>
131
#### :no_entry: MacOS for a local testnet :no_entry:
132

133 134
Before running the script make sure you have installed/updated XCode. Note: The build script
will install homebrew if it is not already installed on you system. [Homebrew Website](https://brew.sh)
135

136
Then clone the EOS repository recursively and run eosio_build.sh in the root `eos` folder.
137

138 139 140
```bash
git clone https://github.com/eosio/eos --recursive
cd eos
141
./eosio_build.sh
142 143
```

J
Jonathan Giszczak 已提交
144 145 146 147 148 149
For ease of contract development, one further step is required:

```bash
make install
```

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

152
<a name="automacpublic"></a>
153
#### MacOS for the public testnet
154

155 156
Before running the script make sure you have installed/updated XCode. Note: The build script
will install homebrew if it is not already installed on you system. [Homebrew Website](https://brew.sh)
157

158
Then clone the EOS repository recursively, checkout the branch that is compatible with the public testnet, and run eosio_build.sh in the root `eos` folder.
159 160 161 162

```bash
git clone https://github.com/eosio/eos --recursive
cd eos
163 164 165
git checkout DAWN-2018-02-14
git submodule update --recursive
./build.sh
166 167
```

J
Jonathan Giszczak 已提交
168 169 170 171 172 173
For ease of contract development, one further step is required:

```bash
make install
```

174 175
Now you can proceed to the next step - [Running a node on the public testnet](#publictestnet)

S
Serg Metelin 已提交
176
<a name="runanode"></a>
177
## Building EOS and running a node
S
Serg Metelin 已提交
178

S
Serg Metelin 已提交
179
<a name="getcode"></a>
180
### Getting the code
S
Serg Metelin 已提交
181

182
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 已提交
183

184 185 186
```bash
git clone https://github.com/eosio/eos --recursive
```
N
Nathan Hourt 已提交
187 188 189

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:

190 191 192
```bash
git submodule update --init --recursive
```
N
Nathan Hourt 已提交
193

S
Serg Metelin 已提交
194
<a name="build"></a>
195
### Building from source code
196

197
```bash
S
Serg Metelin 已提交
198
cd ~
199
git clone https://github.com/eosio/eos --recursive
S
Serg Metelin 已提交
200
mkdir -p ~/eos/build && cd ~/eos/build
A
Alessandro Siniscalchi 已提交
201
cmake -DBINARYEN_BIN=~/binaryen/bin -DWASM_ROOT=~/wasm-compiler/llvm -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib ..
202
make -j$( nproc )
203 204 205
```

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 已提交
206 207 208 209 210

`-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`.

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

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

215 216
* nodeos - server-side blockchain node component
* cleos - command line interface to interact with the blockchain
217 218
* eosiowd - EOS wallet
* eosio-launcher - application for nodes network composing and deployment; [more on eosio-launcher](https://github.com/EOSIO/eos/blob/master/testnet.md)
S
Serg Metelin 已提交
219

S
Serg Metelin 已提交
220
<a name="singlenode"></a>
221
### Creating and launching a single-node testnet
S
Serg Metelin 已提交
222

223
After successfully building the project, the `nodeos` binary should be present in the `build/programs/nodeos` directory. Run `nodeos` -- it will probably exit with an error, but if not, close it immediately with <kbd>Ctrl-C</kbd>. If it exited with an error, note that `nodeos` 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 `nodeos`.  These instructions will continue to use the default directory.
N
Nathan Hourt 已提交
224

225
Edit the `config.ini` file, adding/updating the following settings to the defaults already in place:
N
Nathan Hourt 已提交
226 227

```
N
Nathan Hourt 已提交
228 229
# Load the testnet genesis state, which creates some initial block producers with the default key
genesis-json = /path/to/eos/source/genesis.json
S
Sandwich 已提交
230
 # Enable production on a stale chain, since a single-node test chain is pretty much always stale
N
Nathan Hourt 已提交
231 232
enable-stale-production = true
# Enable block production with the testnet producers
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
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 已提交
254
# Load the block producer plugin, so you can produce blocks
P
Pravin 已提交
255
plugin = eosio::producer_plugin
S
Serg Metelin 已提交
256
# Wallet plugin
P
Pravin 已提交
257
plugin = eosio::wallet_api_plugin
S
Serg Metelin 已提交
258
# As well as API and HTTP plugins
P
Pravin 已提交
259 260
plugin = eosio::chain_api_plugin
plugin = eosio::http_plugin
N
Nathan Hourt 已提交
261 262
```

263 264
Now it should be possible to run `nodeos` and see it begin producing blocks.
You can specify the location of a custom `config.ini` by passing the `--config-dir` argument to `nodeos`.
peterwillcn's avatar
peterwillcn 已提交
265

266
When running `nodeos` you should get log messages similar to below. It means the blocks are successfully produced.
S
Serg Metelin 已提交
267 268 269 270 271 272

```
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
273
...
S
Serg Metelin 已提交
274
```
J
Jonathan Giszczak 已提交
275 276 277 278
<a name="nextsteps"></a>
### Next Steps

Further documentation is available in the [wiki](https://github.com/EOSIO/eos/wiki). Wiki pages include detailed reference documentation for all programs and tools and the database schema and API. The wiki also includes a section describing smart contract development. A simple walkthrough of the "currency" contract follows.
S
Serg Metelin 已提交
279

S
Sandwich 已提交
280
<a name="smartcontracts"></a>
S
Sandwich 已提交
281
## Example "Currency" Contract Walkthrough
S
Serg Metelin 已提交
282

283
EOS comes with example contracts that can be uploaded and run for testing purposes. Next we demonstrate how to upload and interact with the sample contract "currency".
S
Serg Metelin 已提交
284

S
Serg Metelin 已提交
285
<a name="smartcontractexample"></a>
S
Sandwich 已提交
286
### Example smart contracts
287

S
Sandwich 已提交
288
First, run the node
S
Serg Metelin 已提交
289

290
```bash
291 292
cd ~/eos/build/programs/nodeos/
./nodeos
S
Serg Metelin 已提交
293
```
294

S
Serg Metelin 已提交
295
<a name="walletimport"></a>
296
### Setting up a wallet and importing account key
S
Serg Metelin 已提交
297

298
As you've previously added `plugin = eosio::wallet_api_plugin` into `config.ini`, EOS wallet will be running as a part of `nodeos` process. Every contract requires an associated account, so first, create a wallet.
S
Serg Metelin 已提交
299

300
```bash
301 302
cd ~/eos/build/programs/cleos/
./cleos wallet create # Outputs a password that you need to save to be able to lock/unlock the wallet
S
Serg Metelin 已提交
303 304
```

K
Kevin Heifner 已提交
305
For the purpose of this walkthrough, import the private key of the `eosio` account, a system account included within genesis.json, so that you're able to issue API commands under authority of an existing account. The private key referenced below is found within your `config.ini` and is provided to you for testing purposes.
S
Sandwich 已提交
306

S
Sandwich 已提交
307
```bash
308
./cleos wallet import 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
S
Sandwich 已提交
309
```
S
Serg Metelin 已提交
310

S
Serg Metelin 已提交
311
<a name="createaccounts"></a>
S
Sandwich 已提交
312
### Creating accounts for sample "currency" contract
S
Serg Metelin 已提交
313

S
Sandwich 已提交
314
First, generate some public/private key pairs that will be later assigned as `owner_key` and `active_key`.
315

316
```bash
317 318 319
cd ~/eos/build/programs/cleos/
./cleos create key # owner_key
./cleos create key # active_key
320 321
```

S
Sandwich 已提交
322
This will output two pairs of public and private keys
323 324 325

```
Private key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
326
Public key: EOSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
327 328
```

S
Sandwich 已提交
329
**Important:**
330 331
Save the values for future reference.

332
Run the `create` command where `eosio` is the account authorizing the creation of the `currency` account and `PUBLIC_KEY_1` and `PUBLIC_KEY_2` are the values generated by the `create key` command
333

334
```bash
335
./cleos create account eosio currency PUBLIC_KEY_1 PUBLIC_KEY_2
336 337
```

338
You should then get a JSON response back with a transaction ID confirming it was executed successfully.
339

S
Sandwich 已提交
340
Go ahead and check that the account was successfully created
341

342
```bash
343
./cleos get account currency
344 345
```

346
If all went well, you will receive output similar to the following:
347 348 349

```json
{
350 351
  "account_name": "currency",
  "eos_balance": "0.0000 EOS",
352
  "staked_balance": "0.0001 EOS",
353 354 355
  "unstaking_balance": "0.0000 EOS",
  "last_unstaking_time": "2035-10-29T06:32:22",
...
356 357
```

S
Sandwich 已提交
358
Now import the active private key generated previously in the wallet:
359 360

```bash
361
./cleos wallet import XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
362 363
```

S
Serg Metelin 已提交
364
<a name="uploadsmartcontract"></a>
365
### Upload sample "currency" contract to blockchain
366

S
Sandwich 已提交
367
Before uploading a contract, verify that there is no current contract:
D
Daniel Larimer 已提交
368

369
```bash
370
./cleos get code currency
D
Daniel Larimer 已提交
371 372 373
code hash: 0000000000000000000000000000000000000000000000000000000000000000
```

S
Sandwich 已提交
374
With an account for a contract created, upload a sample contract:
375

376
```bash
377
./cleos set contract currency ../../contracts/currency/currency.wast ../../contracts/currency/currency.abi
S
Serg Metelin 已提交
378 379
```

380
As a response you should get a JSON with a `transaction_id` field. Your contract was successfully uploaded!
S
Serg Metelin 已提交
381

382
You can also verify that the code has been set with the following command:
D
Daniel Larimer 已提交
383

384
```bash
385
./cleos get code currency
S
Sandwich 已提交
386 387
```

388
It will return something like:
S
Sandwich 已提交
389
```bash
D
Daniel Larimer 已提交
390 391 392
code hash: 9b9db1a7940503a88535517049e64467a6e8f4e9e03af15e9968ec89dd794975
```

393 394 395
Before using the currency contract, you must issue the currency.

```bash
396
./cleos push action currency issue '{"to":"currency","quantity":"1000.0000 CUR"}' --permission currency@active
397 398
```

S
Sandwich 已提交
399
Next verify the currency contract has the proper initial balance:
D
Daniel Larimer 已提交
400

401
```bash
402
./cleos get table currency currency account
D
Daniel Larimer 已提交
403 404
{
  "rows": [{
405 406
     "currency": 1381319428,
     "balance": 10000000
D
Daniel Larimer 已提交
407 408 409 410 411 412
     }
  ],
  "more": false
}
```

S
Serg Metelin 已提交
413
<a name="pushamessage"></a>
414
### Transfering funds with the sample "currency" contract
415

416
Anyone can send any message to any contract at any time, but the contracts may reject messages which are not given necessary permission. Messages are not sent "from" anyone, they are sent "with permission of" one or more accounts and permission levels. The following commands show a "transfer" message being sent to the "currency" contract.
S
Serg Metelin 已提交
417

418
The content of the message is `'{"from":"currency","to":"eosio","quantity":"20.0000 CUR","memo":"any string"}'`. In this case we are asking the currency contract to transfer funds from itself to someone else. This requires the permission of the currency contract.
S
Serg Metelin 已提交
419

420
```bash
421
./cleos push action currency transfer '{"from":"currency","to":"eosio","quantity":"20.0000 CUR","memo":"my first transfer"}' --permission currency@active
D
Daniel Larimer 已提交
422 423
```

424
Below is a generalization that shows the `currency` account is only referenced once, to specify which contract to deliver the `transfer` message to.
425 426

```bash
427
./cleos push action currency transfer '{"from":"${usera}","to":"${userb}","quantity":"20.0000 CUR","memo":""}' --permission ${usera}@active
428 429
```

430
As confirmation of a successfully submitted transaction, you will receive JSON output that includes a `transaction_id` field.
D
Daniel Larimer 已提交
431

S
Serg Metelin 已提交
432
<a name="readingcontract"></a>
S
Sandwich 已提交
433
### Reading sample "currency" contract balance
434

435
So now check the state of both of the accounts involved in the previous transaction.
D
Daniel Larimer 已提交
436

437
```bash
438
./cleos get table eosio currency account
D
Daniel Larimer 已提交
439 440
{
  "rows": [{
441 442
      "currency": 1381319428,
      "balance": 200000
D
Daniel Larimer 已提交
443 444 445 446
       }
    ],
  "more": false
}
447
./cleos get table currency currency account
D
Daniel Larimer 已提交
448 449
{
  "rows": [{
450 451
      "currency": 1381319428,
      "balance": 9800000
D
Daniel Larimer 已提交
452 453 454 455
    }
  ],
  "more": false
}
S
Serg Metelin 已提交
456 457
```

458
As expected, the receiving account **eosio** now has a balance of **20** tokens, and the sending account now has **20** less tokens than its initial supply.
S
Sandwich 已提交
459

S
Serg Metelin 已提交
460
<a name="localtestnet"></a>
461
## Running multi-node local testnet
S
Serg Metelin 已提交
462

463
To run a local testnet you can use the `eosio-launcher` application provided in the `~/eos/build/programs/eosio-launcher` folder.
S
Serg Metelin 已提交
464

465
For testing purposes you will run two local production nodes talking to each other.
S
Serg Metelin 已提交
466

467
```bash
S
Serg Metelin 已提交
468 469
cd ~/eos/build
cp ../genesis.json ./
470
./programs/eosio-launcher/eosio-launcher -p2 --skip-signature
S
Serg Metelin 已提交
471 472
```

473
This command will generate two data folders for each instance of the node: `tn_data_00` and `tn_data_01`.
S
Serg Metelin 已提交
474

475
You should see the following response:
S
Serg Metelin 已提交
476

477
```bash
478 479
spawning child, programs/nodeos/nodeos --skip-transaction-signatures --data-dir tn_data_0
spawning child, programs/nodeos/nodeos --skip-transaction-signatures --data-dir tn_data_1
S
Serg Metelin 已提交
480 481
```

482
To confirm the nodes are running, run the following `cleos` commands:
483
```bash
484 485 486
~/eos/build/programs/cleos
./cleos -p 8888 get info
./cleos -p 8889 get info
S
Serg Metelin 已提交
487 488
```

489
For each command, you should get a JSON response with blockchain information.
S
Serg Metelin 已提交
490

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

493 494 495 496 497 498 499 500 501 502 503 504 505 506 507
<a name="publictestnet"></a>
## Running a local node connected to the public testnet

To run a local node connected to the public testnet operated by block.one, a script is provided.

```bash
cd ~/eos/build/scripts
./start_npnode.sh
```

This command will use the data folder provided for the instance called `testnet_np`.

You should see the following response:

```bash
508 509
Launched eosd.
See testnet_np/stderr.txt for eosd output.
510 511 512
Synching requires at least 8 minutes, depending on network conditions.
```

513
To confirm eosd operation and synchronization:
514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534

```bash
tail -F testnet_np/stderr.txt
```

To exit tail, use Ctrl-C.  During synchronization, you will see log messages similar to:

```bash
3439731ms            chain_plugin.cpp:272          accept_block         ] Syncing Blockchain --- Got block: #200000 time: 2017-12-09T07:56:32 producer: initu
3454532ms            chain_plugin.cpp:272          accept_block         ] Syncing Blockchain --- Got block: #210000 time: 2017-12-09T13:29:52 producer: initc
```

Synchronization is complete when you see log messages similar to:

```bash
42467ms            net_plugin.cpp:1245           start_sync           ] Catching up with chain, our last req is 351734, theirs is 351962 peer ip-10-160-11-116:9876
42792ms            chain_controller.cpp:208      _push_block          ] initt #351947 @2017-12-12T22:59:44  | 0 trx, 0 pending, exectime_ms=0
42793ms            chain_controller.cpp:208      _push_block          ] inito #351948 @2017-12-12T22:59:46  | 0 trx, 0 pending, exectime_ms=0
42793ms            chain_controller.cpp:208      _push_block          ] initd #351949 @2017-12-12T22:59:48  | 0 trx, 0 pending, exectime_ms=0
```

535 536
This eosd instance listens on 127.0.0.1:8888 for http requests, on all interfaces at port 9877
for p2p requests, and includes the wallet plugins.
537

S
Serg Metelin 已提交
538
<a name="doxygen"></a>
539
## Doxygen documentation
S
Serg Metelin 已提交
540

541 542 543
You can find more detailed API documentation in the Doxygen reference.
For the `master` branch: https://eosio.github.io/eos/
For the public testnet branch: http://htmlpreview.github.io/?https://github.com/EOSIO/eos/blob/dawn-2.x/docs/index.html
S
Serg Metelin 已提交
544

S
Serg Metelin 已提交
545
<a name="docker"></a>
546
## Running EOS in Docker
peterwillcn's avatar
peterwillcn 已提交
547

548 549 550
You can find up to date information about EOS Docker in the [Docker Readme](https://github.com/EOSIO/eos/blob/master/Docker/README.md)

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

553
If you prefer to manually build dependencies, follow the steps below.
554 555 556 557 558 559 560

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
561
* Boost 1.66
562 563 564 565
* OpenSSL
* LLVM 4.0
* [secp256k1-zkp (Cryptonomex branch)](https://github.com/cryptonomex/secp256k1-zkp.git)

566
<a name="manualdepamazon"></a>
567
### Clean install Amazon 2017.09 and higher
568 569 570 571

Install the development toolkit:

```bash
572 573 574
sudo yum update
sudo yum install git gcc72.x86_64 gcc72-c++.x86_64 autoconf automake libtool make bzip2 \
				 bzip2-devel.x86_64 openssl-devel.x86_64 gmp.x86_64 gmp-devel.x86_64 \
575
				 libstdc++72.x86_64 python36-devel.x86_64 libedit-devel.x86_64 \
576 577
				 ncurses-devel.x86_64 swig.x86_64 gettext-devel.x86_64

578 579
```

580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605
Install CMake 3.10.2:

```bash
cd ~
curl -L -O https://cmake.org/files/v3.10/cmake-3.10.2.tar.gz
tar xf cmake-3.10.2.tar.gz
rm -f cmake-3.10.2.tar.gz
ln -s cmake-3.10.2/ cmake
cd cmake
./bootstrap
make
sudo make install
```

Install Boost 1.66:

```bash
cd ~
curl -L https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2 > boost_1.66.0.tar.bz2
tar xf boost_1.66.0.tar.bz2
echo "export BOOST_ROOT=$HOME/boost_1_66_0" >> ~/.bash_profile
source ~/.bash_profile
cd boost_1_66_0/
./bootstrap.sh "--prefix=$BOOST_ROOT"
./b2 install
```
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649
Install [MongoDB (mongodb.org)](https://www.mongodb.com):

```bash
mkdir ${HOME}/opt
cd ${HOME}/opt
curl -OL https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon-3.6.3.tgz
tar xf mongodb-linux-x86_64-amazon-3.6.3.tgz
rm -f mongodb-linux-x86_64-amazon-3.6.3.tgz
ln -s ${HOME}/opt/mongodb-linux-x86_64-amazon-3.6.3/ ${HOME}/opt/mongodb
mkdir ${HOME}/opt/mongodb/data
mkdir ${HOME}/opt/mongodb/log
touch ${HOME}/opt/mongodb/log/mongod.log
		
tee > /dev/null ${HOME}/opt/mongodb/mongod.conf <<mongodconf
systemLog:
 destination: file
 path: ${HOME}/opt/mongodb/log/mongod.log
 logAppend: true
 logRotate: reopen
net:
 bindIp: 127.0.0.1,::1
 ipv6: true
storage:
 dbPath: ${HOME}/opt/mongodb/data
mongodconf

export PATH=${HOME}/opt/mongodb/bin:$PATH
mongod -f ${HOME}/opt/mongodb/mongod.conf
```
Install [mongo-cxx-driver (release/stable)](https://github.com/mongodb/mongo-cxx-driver):

```bash
cd ~
curl -LO https://github.com/mongodb/mongo-c-driver/releases/download/1.9.3/mongo-c-driver-1.9.3.tar.gz
tar xf mongo-c-driver-1.9.3.tar.gz
cd mongo-c-driver-1.9.3
./configure --enable-ssl=openssl --disable-automatic-init-and-cleanup --prefix=/usr/local
make -j$( nproc )
sudo make install
git clone https://github.com/mongodb/mongo-cxx-driver.git --branch releases/stable --depth 1
cd mongo-cxx-driver/build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
sudo make -j$( nproc )
```
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684

Install [secp256k1-zkp (Cryptonomex branch)](https://github.com/cryptonomex/secp256k1-zkp.git):

```bash
cd ~
git clone https://github.com/cryptonomex/secp256k1-zkp.git
cd secp256k1-zkp
./autogen.sh
./configure
make -j$( nproc )
sudo make install
```

By default LLVM and clang do not include the WASM build target, so you will have to build it yourself:

```bash
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 -j$( nproc ) 
make install
```

Your environment is set up. Now you can <a href="#runanode">build EOS and run a node</a>.

<a name="manualdepcentos"></a>
### Clean install Centos 7 and higher

Install the development toolkit:
685 686 687
* Installation on Centos requires installing/enabling the Centos Software Collections
Repository.
[Centos SCL](https://wiki.centos.org/AdditionalResources/Repositories/SCL):
688 689 690 691 692 693

```bash
sudo yum --enablerepo=extras install centos-release-scl
sudo yum update
sudo yum install -y devtoolset-7
scl enable devtoolset-7 bash
694 695
sudo yum install -y python33.x86_64
scl enable python33 bash
696
sudo yum install git autoconf automake libtool make bzip2 \
697
				 bzip2-devel.x86_64 openssl-devel.x86_64 gmp-devel.x86_64 \
698
				 ocaml.x86_64 doxygen libicu-devel.x86_64 python-devel.x86_64 \
699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714
				 gettext-devel.x86_64

```

Install CMake 3.10.2:

```bash
cd ~
curl -L -O https://cmake.org/files/v3.10/cmake-3.10.2.tar.gz
tar xf cmake-3.10.2.tar.gz
cd cmake-3.10.2
./bootstrap
make -j$( nproc )
sudo make install
```

715
Install Boost 1.66:
716 717 718

```bash
cd ~
719 720
curl -L https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2 > boost_1.66.0.tar.bz2
tar xf boost_1.66.0.tar.bz2
721
echo "export BOOST_ROOT=$HOME/boost_1_66_0" >> ~/.bash_profile
722
source ~/.bash_profile
723
cd boost_1_66_0/
724 725 726 727
./bootstrap.sh "--prefix=$BOOST_ROOT"
./b2 install
```

728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773
Install [MongoDB (mongodb.org)](https://www.mongodb.com):

```bash
mkdir ${HOME}/opt
cd ${HOME}/opt
curl -OL https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon-3.6.3.tgz
tar xf mongodb-linux-x86_64-amazon-3.6.3.tgz
rm -f mongodb-linux-x86_64-amazon-3.6.3.tgz
ln -s ${HOME}/opt/mongodb-linux-x86_64-amazon-3.6.3/ ${HOME}/opt/mongodb
mkdir ${HOME}/opt/mongodb/data
mkdir ${HOME}/opt/mongodb/log
touch ${HOME}/opt/mongodb/log/mongod.log
		
tee > /dev/null ${HOME}/opt/mongodb/mongod.conf <<mongodconf
systemLog:
 destination: file
 path: ${HOME}/opt/mongodb/log/mongod.log
 logAppend: true
 logRotate: reopen
net:
 bindIp: 127.0.0.1,::1
 ipv6: true
storage:
 dbPath: ${HOME}/opt/mongodb/data
mongodconf

export PATH=${HOME}/opt/mongodb/bin:$PATH
mongod -f ${HOME}/opt/mongodb/mongod.conf
```

Install [mongo-cxx-driver (release/stable)](https://github.com/mongodb/mongo-cxx-driver):

```bash
cd ~
curl -LO https://github.com/mongodb/mongo-c-driver/releases/download/1.9.3/mongo-c-driver-1.9.3.tar.gz
tar xf mongo-c-driver-1.9.3.tar.gz
cd mongo-c-driver-1.9.3
./configure --enable-ssl=openssl --disable-automatic-init-and-cleanup --prefix=/usr/local
make -j$( nproc )
sudo make install
git clone https://github.com/mongodb/mongo-cxx-driver.git --branch releases/stable --depth 1
cd mongo-cxx-driver/build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
sudo make -j$( nproc )
```

774
Install [secp256k1-zkp (Cryptonomex branch)](https://github.com/cryptonomex/secp256k1-zkp.git):
775

776 777 778 779 780 781
```bash
cd ~
git clone https://github.com/cryptonomex/secp256k1-zkp.git
cd secp256k1-zkp
./autogen.sh
./configure
782
make -j$( nproc )
783 784 785 786 787 788 789 790 791 792 793 794 795 796
sudo make install
```

By default LLVM and clang do not include the WASM build target, so you will have to build it yourself:

```bash
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
797 798
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=.. -DLLVM_TARGETS_TO_BUILD= -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly 
-DLLVM_ENABLE_RTTI=1 -DCMAKE_BUILD_TYPE=Release ../
799 800
make -j$( nproc ) 
make install
801
```
802

803
Your environment is set up. Now you can <a href="#runanode">build EOS and run a node</a>.
804

805
<a name="manualdepfedora"></a>
806
### Clean install Fedora 25 and higher
807

808
Install the development toolkit:
809 810

```bash
811 812
sudo yum update
sudo yum install git gcc.x86_64 gcc-c++.x86_64 autoconf automake libtool make cmake.x86_64 \
813 814
				 bzip2-devel.x86_64 openssl-devel.x86_64 gmp-devel.x86_64 \
				 libstdc++-devel.x86_64 python3-devel.x86_64 libedit.x86_64 \
815 816
				 mongodb.x86_64 mongodb-server.x86_64 ncurses-devel.x86_64 \
				 swig.x86_64 gettext-devel.x86_64
817 818 819

```

820
Install Boost 1.66:
821 822

```bash
823 824 825 826 827 828 829 830
cd ~
curl -L https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2 > boost_1.66.0.tar.bz2
tar xf boost_1.66.0.tar.bz2
echo "export BOOST_ROOT=$HOME/boost_1_66_0" >> ~/.bash_profile
source ~/.bash_profile
cd boost_1_66_0/
./bootstrap.sh "--prefix=$BOOST_ROOT"
./b2 install
831
```
832 833 834 835 836 837 838 839 840 841 842 843 844 845 846
Install [mongo-cxx-driver (release/stable)](https://github.com/mongodb/mongo-cxx-driver):

```bash
cd ~
curl -LO https://github.com/mongodb/mongo-c-driver/releases/download/1.9.3/mongo-c-driver-1.9.3.tar.gz
tar xf mongo-c-driver-1.9.3.tar.gz
cd mongo-c-driver-1.9.3
./configure --enable-ssl=openssl --disable-automatic-init-and-cleanup --prefix=/usr/local
make -j$( nproc )
sudo make install
git clone https://github.com/mongodb/mongo-cxx-driver.git --branch releases/stable --depth 1
cd mongo-cxx-driver/build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
sudo make -j$( nproc )
```
847 848

Install [secp256k1-zkp (Cryptonomex branch)](https://github.com/cryptonomex/secp256k1-zkp.git):
849

850 851 852 853 854 855
```bash
cd ~
git clone https://github.com/cryptonomex/secp256k1-zkp.git
cd secp256k1-zkp
./autogen.sh
./configure
856
make -j$( nproc )
857 858 859
sudo make install
```

860
By default LLVM and clang do not include the WASM build target, so you will have to build it yourself:
861 862 863 864 865 866 867 868 869 870 871

```bash
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 ../
872
make -j$( nproc ) install
873 874
```

875
Your environment is set up. Now you can <a href="#runanode">build EOS and run a node</a>.
876

877
<a name="manualdepubuntu"></a>
878
### Clean install Ubuntu 16.04 & Linux Mint 18
879 880 881 882

Install the development toolkit:

```bash
883 884 885 886 887 888
sudo apt-get update
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo apt-get install clang-4.0 lldb-4.0 libclang-4.0-dev cmake make \
                     libbz2-dev libssl-dev libgmp3-dev \
                     autotools-dev build-essential \
                     libbz2-dev libicu-dev python-dev \
889
                     autoconf libtool git mongodb
890 891 892 893 894 895
```

Install Boost 1.66:

```bash
cd ~
896
wget -c 'https://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.tar.bz2/download' -O boost_1.66.0.tar.bz2
897 898
tar xjf boost_1.66.0.tar.bz2
cd boost_1_66_0/
899
echo "export BOOST_ROOT=$HOME/boost_1_66_0" >> ~/.bash_profile
900 901 902
source ~/.bash_profile
./bootstrap.sh "--prefix=$BOOST_ROOT"
./b2 install
903
source ~/.bash_profile
904 905
```

906
Install [mongo-cxx-driver (release/stable)](https://github.com/mongodb/mongo-cxx-driver):
907 908 909 910 911 912 913 914 915 916 917 918 919 920 921

```bash
cd ~
curl -LO https://github.com/mongodb/mongo-c-driver/releases/download/1.9.3/mongo-c-driver-1.9.3.tar.gz
tar xf mongo-c-driver-1.9.3.tar.gz
cd mongo-c-driver-1.9.3
./configure --enable-ssl=openssl --disable-automatic-init-and-cleanup --prefix=/usr/local
make -j$( nproc )
sudo make install
git clone https://github.com/mongodb/mongo-cxx-driver.git --branch releases/stable --depth 1
cd mongo-cxx-driver/build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
sudo make -j$( nproc )
```

922 923 924 925 926 927 928 929
Install [secp256k1-zkp (Cryptonomex branch)](https://github.com/cryptonomex/secp256k1-zkp.git):

```bash
cd ~
git clone https://github.com/cryptonomex/secp256k1-zkp.git
cd secp256k1-zkp
./autogen.sh
./configure
930
make
931 932 933 934 935 936 937 938 939 940 941 942 943 944 945
sudo make install
```

By default LLVM and clang do not include the WASM build target, so you will have to build it yourself:

```bash
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 ../
946
make -j4 install
947
```
948

949 950
Your environment is set up. Now you can <a href="#runanode">build EOS and run a node</a>.

951
<a name="manualdepmacos"></a>
952
### MacOS Sierra 10.12.6 & higher
953

954 955 956 957
macOS additional Dependencies:

* Brew
* Newest XCode
958
* MongoDB C++ driver
959 960

Upgrade your XCode to the newest version:
961 962

```bash
963 964 965 966
xcode-select --install
```

Install homebrew:
967

968 969
```bash
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
970 971
```

972
Install the dependencies:
973 974

```bash
975
brew update
976
brew install git automake libtool cmake boost openssl@1.0 llvm@4 gmp ninja gettext mongodb
977
brew link gettext --force
978
```
979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002
Install [mongo-cxx-driver (release/stable)](https://github.com/mongodb/mongo-cxx-driver):

```bash
cd ~
brew install --force pkgconfig
brew unlink pkgconfig && brew link --force pkgconfig
curl -LO https://github.com/mongodb/mongo-c-driver/releases/download/1.9.3/mongo-c-driver-1.9.3.tar.gz
tar xf mongo-c-driver-1.9.3.tar.gz
rm -f mongo-c-driver-1.9.3.tar.gz
cd mongo-c-driver-1.9.3
./configure --enable-ssl=darwin --disable-automatic-init-and-cleanup --prefix=/usr/local
make -j$( sysctl -in machdep.cpu.core_count )
sudo make install
cd ..
rm -rf mongo-c-driver-1.9.3

git clone https://github.com/mongodb/mongo-cxx-driver.git --branch releases/stable --depth 1
cd mongo-cxx-driver/build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
make -j$( sysctl -in machdep.cpu.core_count )
sudo make install
cd ..
rm -rf mongo-cxx-driver
```
1003 1004 1005 1006 1007 1008 1009 1010 1011

Install [secp256k1-zkp (Cryptonomex branch)](https://github.com/cryptonomex/secp256k1-zkp.git):

```bash
cd ~
git clone https://github.com/cryptonomex/secp256k1-zkp.git
cd secp256k1-zkp
./autogen.sh
./configure
1012
make -j$( sysctl -in machdep.cpu.core_count )
1013 1014 1015
sudo make install
```

1016
Build LLVM and clang for WASM:
1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027

```bash
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 ../
1028
make -j$( sysctl -in machdep.cpu.core_count )
1029 1030 1031
make install
```

1032
Your environment is set up. Now you can <a href="#runanode">build EOS and run a node</a>.