提交 bc2dc4fe 编写于 作者: S Serg Metelin

Cleaning up the README.md

Cleaning up the BINARYEN how-to
上级 b858441c
......@@ -11,12 +11,14 @@ The following instructions overview the process of getting the software, buildin
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)
### Clean install Ubuntu 16.10
......@@ -36,12 +38,13 @@ Install Boost 1.64:
```commandline
cd ~
export BOOST_ROOT=$HOME/opt/boost_1_64_0
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/
./bootstrap.sh "--prefix=$BOOST_ROOT"
./b2 install
echo "export BOOST_ROOT=$HOME/opt/boost_1_64_0" >> ~/.bash_profile
source ~/.bash_profile
```
Install [secp256k1-zkp (Cryptonomex branch)](https://github.com/cryptonomex/secp256k1-zkp.git):
......@@ -56,9 +59,25 @@ make
sudo make install
```
### LLVM with WASM build target
Also, to use the WASM compiler, eos has an external dependency on [binaryen](https://github.com/WebAssembly/binaryen.git):
```commandline
cd ~
git clone https://github.com/WebAssembly/binaryen.git
cd ~/binaryen
git checkout tags/1.37.14
cmake . && make
```
Add BINARYEN_ROOT to your .bash_profile:
```commandline
echo "export BINARYEN_ROOT=~/binaryen" >> ~/.bash_profile
source ~/.bash_profile
```
By default LLVM and clang do not include the WASM build target, so you will have to build it yourself. Note that following these instructions will create a version of LLVM that can only build WASM targets.
By default LLVM and clang do not include the WASM build target, so you will have to build it yourself:
```commandline
mkdir ~/wasm-compiler
......@@ -76,6 +95,7 @@ make -j4 install
### macOS Sierra 10.12.6
macOS additional Dependencies:
* Brew
* Newest XCode
......@@ -110,6 +130,24 @@ make
sudo make install
```
Install [binaryen v1.37.14](https://github.com/WebAssembly/binaryen.git):
```commandline
cd ~
git clone https://github.com/WebAssembly/binaryen.git
cd ~/binaryen
git checkout tags/1.37.14
cmake . && make
```
Add BINARYEN_ROOT to your .bash_profile:
```commandline
echo "export BINARYEN_ROOT=~/binaryen" >> ~/.bash_profile
source ~/.bash_profile
```
Build LLVM and clang for WASM:
```commandline
......@@ -130,8 +168,11 @@ Add WASM_LLVM_CONFIG and LLVM_DIR to your .bash_profile:
```commandline
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
source ~/.bash_profile
```
## Building and running a node
### Getting the code
To download all of the code, download Eos and a recursion or two of submodules. The easiest way to get all of this is to do a recursive clone:
......@@ -146,19 +187,11 @@ If a repo is cloned without the `--recursive` flag, the submodules can be retrie
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.
Also, to use the WASM compiler, eos has an external dependency on
- [binaryen](https://github.com/WebAssembly/binaryen.git)
* need to checkout tag 1.37.21
* also need to run "make install"
* if installed in a location outside of PATH, need to set BINARYEN_ROOT to cmake
#### On Ubuntu:
```commandline
cd ~
git clone https://github.com/eosio/eos --recursive
mkdir -p eos/build && cd eos/build
export BOOST_ROOT=$HOME/opt/boost_1_64_0
cmake -DWASM_LLVM_CONFIG=~/wasm-compiler/llvm/bin/llvm-config -DBOOST_ROOT="$BOOST_ROOT" ..
mkdir -p ~/eos/build && cd ~/eos/build
cmake -DBINARYEN_BIN=~/binaryen/bin ..
make -j4
```
......@@ -166,15 +199,6 @@ Out-of-source builds are also supported. To override clang's default choice in c
`-DCMAKE_CXX_COMPILER=/path/to/c++ -DCMAKE_C_COMPILER=/path/to/cc`
#### On macOS:
```commandline
git clone https://github.com/eosio/eos --recursive
mkdir -p eos/build && cd eos/build
cmake ..
make -j4
```
For a debug build, add `-DCMAKE_BUILD_TYPE=Debug`. Other common build types include `Release` and `RelWithDebInfo`.
To run the test suite after building, run the `chain_test` executable in the `tests` folder.
......@@ -220,11 +244,22 @@ plugin = eos::http_plugin
Now it should be possible to run `eosd` and see it begin producing blocks. At present, the P2P code is not implemented, so only single-node configurations are possible. When the P2P networking is implemented, these instructions will be updated to show how to create an example multi-node testnet.
## Accounts and smart contracts
EOS comes with example contracts that can be uploaded and run. To upload and test them, please follow the steps below.
### Create accounts for your smart contracts
To publish sample smart contracts you need to create accounts for them.
At the moment for the testing purposes you need to run `eosd --skip-transaction-signatures` to successfully create accounts and run transactions.
At the moment for the testing purposes you need to run `eosd` with `--skip-transaction-signatures` flag to successfully create accounts and run transactions.
Run the node:
```commandline
cd ~/eos/build/programs/eosd/
./eosd --skip-transaction-signatures
```
First, generate public/private key pairs for the `owner_key` and `active_key`. We will need them to create an account:
......@@ -249,10 +284,6 @@ Run `create` command where `PUBLIC_KEY_1` and `PUBLIC_KEY_2` are the values gene
./eosc create account inita exchange PUBLIC_KEY_1 PUBLIC_KEY_2
```
sudo rm -rf /data/store/eos # options
sudo mkdir -p /data/store/eos
docker-compose -f Docker/docker-compose.yml up
You should get a json response back with a transaction ID confirming it was executed successfully.
Check that account was successfully created:
......@@ -308,15 +339,6 @@ docker-compose -f Docker/docker-compose.yml up
```
Get chain info
Also, to use the WASM compiler, eos has an external dependency on
- [binaryen](https://github.com/WebAssembly/binaryen.git)
* need to checkout tag 1.37.14
* also need to run "make install"
* if installed in a location outside of PATH, need to set BINARYEN_ROOT to cmake
### Using the WASM compiler to perform a full build of the project
For example:
```
curl http://127.0.0.1:8888/v1/chain/get_info
......@@ -325,6 +347,7 @@ curl http://127.0.0.1:8888/v1/chain/get_info
### Run contract in docker example
You can run the `eosc` commands via `docker exec` command. For example:
```
docker exec docker_eos_1 eosc contract exchange contracts/exchange/exchange.wast contracts/exchange/exchange.abi
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册