原文链接:https://wangwei.one/posts/181733fc.html
官方文档:https://github.com/EOSIO/eos
本文介绍如何使用脚本自动构建eos源代码
系统环境
- macOS Sierra 10.12.6
升级XCode和brew
-
升级XCode
$ xcode-select --install
-
升级brew
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
执行构建脚本
$ git clone https://github.com/eosio/eos --recursive
$ cd eos
$ ./build.sh darwin
耐心等待构建完成,大约 1h20min 左右~构建成功后,在~/eos/build/programs
中会出现如下四个文件夹:
- eosc:与区块链进行交互的命令行界面
- eosd:服务器端区块链节点组件
- eos-walletd:EOS钱包
- launcher:节点网络组成和部署的应用
测试
$ cd ~/eos/bulid/tests
$ ./chain_test
创建并启动单实例测试网络
-
首次运行
~/eos/build/programs/eosd
目录下的eosd
可执行文件,出现错误后,按Ctrl-C
退出。 -
修改
~/eos/build/programs/eosd/data-dir/config.ini
配置文件- 设置
genesis-json
文件路径,在eos跟目录下 - 设置
enable-stale-production = true
- 在文件末尾追加以下内容:
# Enable block production with the testnet producers 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 # Load the block producer plugin, so you can produce blocks plugin = eosio::producer_plugin # Wallet plugin plugin = eosio::wallet_api_plugin # As well as API and HTTP plugins plugin = eosio::chain_api_plugin plugin = eosio::http_plugin
- 设置
-
再次运行
eosd
,出现如下信息,则成功