1. 程式人生 > >MAC本地安裝EOS及問題

MAC本地安裝EOS及問題

本地安裝EOS

EOS是bm(位元股創始人)最新研發的第三代區塊鏈技術,每秒交易可達到百萬級,以太坊每秒也只能達到幾十筆。更適合高併發場景。

EOS的程式碼在github上開源,本文主要內容是如何在本地部署EOS。

  • 系統:Mac最新版

  • 依賴:Boost

  • OpenSSL

  • secp256k1-zkp

依賴環境安裝

因為eos是由c++編寫,所以我們需要安裝cmake等編譯工具。如果是linux無需安裝,mac需要安裝xcode後才可

brew install automake autoconf libtool cmake

這裡我們用homebrew包管理工具,更加簡單方便些。

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Boost

brew install Boost

OpenSSL

brew install OpenSSL

注意⚠️:因為新版mac已經移除openssl,這裡我們安裝完需要配置下環境變數

export OPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2k

export OPENSSL_INCLUDE_DIR=/usr/local/Cellar/openssl/1.0.2k/includes

secp256k1-zkp

git clone https://github.com/cryptonomex/secp256k1-zkp.git

Cd secp256k1-zkp

./autogen.sh

./configure

make

sudo make install

獲取eos程式碼

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

cd eos

cmake .

make

我們跑一下測試程式碼

在tests/目錄下,雙擊chain_test即可執行

第三代區塊鏈技術EOS,本地安裝

執行eos

找到programs目錄下eosd中,雙擊執行eosd

這時候會報錯,需要我們修改下config.ini檔案,全域性搜尋下此檔案

第三代區塊鏈技術EOS,本地安裝

加入

# 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

producer-id = {"_id":0}

producer-id = {"_id":1}

producer-id = {"_id":2}

producer-id = {"_id":3}

producer-id = {"_id":4}

producer-id = {"_id":5}

producer-id = {"_id":6}

producer-id = {"_id":7}

producer-id = {"_id":8}

producer-id = {"_id":9}

producer-id = {"_id":10}

# Load the block producer plugin, so we can produce blocks

plugin = eos::producer_plugin

當然可以以Docker方式安裝

https://github.com/EOSIO/eos/裡有

問題集

1  cmake .時,EOSIO/chainbase下,沒有發現CMakeLists.txt檔案

=

git未完成遞迴下載,手動下載https://github.com/EOSIO/chainbase 分支的,覆蓋chainbase資料夾內容

##############

2  cmake .時,發現找不到 OPENSSL_ROOT_DIR   OPENSSL_INCLUDE_DIR

=

1 進入當前使用者的home目錄
    輸入cd ~


2 編輯.bash_profile    

    輸入 vim  .bash_profile

3在末尾插入

export OPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2k

export OPENSSL_INCLUDE_DIR=/usr/local/Cellar/openssl/1.0.2k/includes

4 重新開一個命令列執行命令即可

####################

3 cmake . 時,發現

 Could not find a package configuration file provided by "LLVM" (requested

  version 4.0) with any of the following names:

    LLVMConfig.cmake

    llvm-config.cmake

  Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set

  "LLVM_DIR" to a directory containing one of the above files.  If "LLVM"

  provides a separate development package or SDK, be sure it has been

  installed.

=

1 下載llvm.....xz

http://releases.llvm.org/download.html#4.0.0    =Pre-Built Binaries: 

mac下的連結為  http://releases.llvm.org/4.0.0/clang+llvm-4.0.0-x86_64-apple-darwin.tar.xz

2 解壓

xz -d clang+llvm-4.0.0-x86_64-apple-darwin.tar.xz 生成tar檔案

tar xvf xxx.tar來解包到目標目錄

3 修改 .bash_profile,在後面追加

export LLVM_DIR = /Users/liyihang/Downloads/clang+llvm-4.0.0-x86_64-apple-darwin/lib/cmake/llvm/LLVMConfig.cmake