EOS开发(一)环境搭建(非Docker)

EOS相关文档

Git地址:
https://github.com/EOSIO/eos

Docs:https://developers.eos.io/eosio-nodeos/docs/overview-1

最简单快速的方式是使用Docker,但是官方建议开发者从源码进行搭建

获取代码

yuyangdeMacBook-Pro: yuyang$ git clone https://github.com/eosio/eos --recursive

如果克隆代码时未带--recursive参数,那么可切换到项目路径下面执行如下命令,下载子模块。

$ git submodule update --init --recursive

编译代码

yuyangdeMacBook-Pro:EOS yuyang$ cd /Users/yuyang/eos 
yuyangdeMacBook-Pro:eos yuyang$ ./eosio_build.sh
_______  _______  _______ _________ _______
   (  ____ \(  ___  )(  ____ \\__   __/(  ___  )
   | (    \/| (   ) || (    \/   ) (   | (   ) |
   | (__    | |   | || (_____    | |   | |   | |
   |  __)   | |   | |(_____  )   | |   | |   | |
   | (      | |   | |      ) |   | |   | |   | |
   | (____/\| (___) |/\____) |___) (___| (___) |
   (_______/(_______)\_______)\_______/(_______)

   EOSIO has been successfully built. 00:14:06

   To verify your installation run the following commands:

   /usr/local/bin/mongod -f /usr/local/etc/mongod.conf &
   cd /Users/yuyang/eos/build; make test

   For more information:
   EOSIO website: https://eos.io
   EOSIO Telegram channel @ https://t.me/EOSProject
   EOSIO resources: https://eos.io/resources/
   EOSIO Stack Exchange: https://eosio.stackexchange.com
   EOSIO wiki: https://github.com/EOSIO/eos/wiki

如果编译失败,可以看看这篇文章Mac上安装EOS Dawn 3.0的一些坑

后面换了电脑又遇到新的两个问题:

CMake Error at /usr/local/Cellar/cmake/3.9.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find GMP (missing: GMP_LIBRARIES GMP_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.9.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:377 (_FPHSA_FAILURE_MESSAGE)

解决办法,参考文章:http://me.tryblockchain.org/eos-howtobuild.html

brew install gmp
Failed to find Gettext libintl (missing: Intl_INCLUDE_DIR)

解决办法,参考文章:http://www.softwareace.cn/?p=1763

brew unlink gettext && brew link --force gettext
find /usr -name libintl* -print 2>/dev/null

安装EOSIO

yuyangdeMacBook-Pro:eos yuyang$ ./eosio_install.sh

失败

[ 96%] Built target deferred_test
[ 98%] Built target unit_test
[100%] Built target plugin_test
[100%] Built target print_floats
Install the project...
-- Install configuration: "Release"
-- Up-to-date: /usr/local/eosio/etc/eosio
CMake Error at cmake_install.cmake:44 (file):
  file INSTALL cannot set permissions on "/usr/local/eosio/etc/eosio"


make: *** [install] Error 1

    >>>>>>>>>>>>>>>>>>>> MAKE installing EOSIO has exited with the above error.

加入sudo权限

yuyangdeMacBook-Pro:eos yuyang$ sudo ./eosio_install.sh
Password:
    Installing EOSIO Binary Symlinks



     _______  _______  _______ _________ _______
    (  ____ \(  ___  )(  ____ \\__   __/(  ___  )
    | (    \/| (   ) || (    \/   ) (   | (   ) |
    | (__    | |   | || (_____    | |   | |   | |
    |  __)   | |   | |(_____  )   | |   | |   | |
    | (      | |   | |      ) |   | |   | |   | |
    | (____/\| (___) |/\____) |___) (___| (___) |
    (_______/(_______)\_______)\_______/(_______)
    For more information:
    EOSIO website: https://eos.io
    EOSIO Telegram channel @ https://t.me/EOSProject
    EOSIO resources: https://eos.io/resources/
    EOSIO Stack Exchange: https://eosio.stackexchange.com
    EOSIO wiki: https://github.com/EOSIO/eos/wiki

EOS附带的可执行程序:

yuyangdeMacBook-Pro:eos yuyang$ cd /Users/yuyang/eos/build/programs 
yuyangdeMacBook-Pro:programs yuyang$ ls
CMakeFiles      cmake_install.cmake keosd
CTestTestfile.cmake eosio-abigen        nodeos
Makefile        eosio-applesedemo
cleos           eosio-launcher
  • nodeos: 区块链服务器节点生成组件
  • cleos: 和区块链交互的接口命令
  • keosd: EOS 钱包
  • eosio-launcher:节点网络组成和部署的应用

所有这些程序/eos/build/programs都存在于这个文件夹。

安装可执行文件

yuyangdeMacBook-Pro:eos yuyang$ cd  build
yuyangdeMacBook-Pro:build yuyang$ sudo make install

建立单个测试节点

切换到目录eos/build/programs/nodeos下面,然后执行如下命令。

yuyangdeMacBook-Pro:programs yuyang$ cd /Users/yuyang/eos/build/programs/nodeos 
yuyangdeMacBook-Pro:nodeos yuyang$ ./nodeos -e -p eosio --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin

报错

2018-08-21T05:53:54.005 thread-0   chain_plugin.cpp:271          plugin_initialize    ] initializing chain plugin
2018-08-21T05:53:54.012 thread-0   chain_plugin.cpp:580          plugin_initialize    ] 13 St13runtime_error: database dirty flag set
rethrow database dirty flag set: 
    {"what":"database dirty flag set"}
    thread-0  chain_plugin.cpp:580 plugin_initialize
2018-08-21T05:53:54.013 thread-0   main.cpp:118                  main                 ] database dirty flag set (likely due to unclean shutdown): replay required

尝试加上–replay-blockchain –hard-replay-blockchain参数

yuyangdeMacBook-Pro:nodeos yuyang$ ./nodeos -e -p eosio --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin –replay-blockchain –hard-replay-blockchain

还是失败

索性删除data文件夹
文件夹位于/Users/yuyang/Library/Application Support

结果

yuyangdeMacBook-Pro:nodeos yuyang$ ./nodeos -e -p eosio --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin
2018-08-21T06:36:51.238 thread-0   chain_plugin.cpp:271          plugin_initialize    ] initializing chain plugin
2018-08-21T06:36:51.238 thread-0   chain_plugin.cpp:508          plugin_initialize    ] Starting up fresh blockchain with default genesis state.
2018-08-21T06:36:52.000 thread-0   http_plugin.cpp:344           plugin_initialize    ] configured http to listen on 127.0.0.1:8888
2018-08-21T06:36:52.000 thread-0   net_plugin.cpp:2905           plugin_initialize    ] Initialize net plugin
2018-08-21T06:36:52.000 thread-0   net_plugin.cpp:2930           plugin_initialize    ] host: 0.0.0.0 port: 9876 
2018-08-21T06:36:52.000 thread-0   net_plugin.cpp:3000           plugin_initialize    ] my node_id is 1a38820d4a44dea82c797340ae46b048edc6c53e7f8332640ed22dcefd58239f
2018-08-21T06:36:52.000 thread-0   main.cpp:105                  main                 ] nodeos version 4f4e5c22
2018-08-21T06:36:52.000 thread-0   main.cpp:106                  main                 ] eosio root is /Users/yuyang/Library/Application Support
2018-08-21T06:36:52.001 thread-0   controller.cpp:1301           startup              ] No head block in fork db, perhaps we need to replay
2018-08-21T06:36:52.001 thread-0   controller.cpp:319            initialize_fork_db   ]  Initializing new blockchain with genesis state                  
2018-08-21T06:36:52.026 thread-0   chain_plugin.cpp:596          plugin_startup       ] starting chain in read/write mode
2018-08-21T06:36:52.026 thread-0   chain_plugin.cpp:600          plugin_startup       ] Blockchain started; head block is #1, genesis timestamp is 2018-06-01T12:00:00.000
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:401           plugin_startup       ] start listening for http requests
2018-08-21T06:36:52.026 thread-0   chain_api_plugin.cpp:75       plugin_startup       ] starting chain_api_plugin
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/abi_bin_to_json
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/abi_json_to_bin
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_abi
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_account
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_block
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_block_header_state
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_code
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_currency_balance
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_currency_stats
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_info
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_producer_schedule
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_producers
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_raw_code_and_abi
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_required_keys
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_scheduled_transactions
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_table_rows
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/push_block
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/push_transaction
2018-08-21T06:36:52.026 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/push_transactions
2018-08-21T06:36:52.026 thread-0   history_api_plugin.cpp:38     plugin_startup       ] starting history_api_plugin
2018-08-21T06:36:52.027 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/history/get_actions
2018-08-21T06:36:52.027 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/history/get_controlled_accounts
2018-08-21T06:36:52.027 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/history/get_key_accounts
2018-08-21T06:36:52.027 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/history/get_transaction
2018-08-21T06:36:52.027 thread-0   net_plugin.cpp:3013           plugin_startup       ] starting listener, max clients is 25
2018-08-21T06:36:52.027 thread-0   producer_plugin.cpp:647       plugin_startup       ] producer plugin:  plugin_startup() begin
2018-08-21T06:36:52.027 thread-0   producer_plugin.cpp:665       plugin_startup       ] Launching block production for 1 producers at 2018-08-21T06:36:52.027.
2018-08-21T06:36:52.029 thread-0   producer_plugin.cpp:677       plugin_startup       ] producer plugin:  plugin_startup() end
2018-08-21T06:36:52.502 thread-0   producer_plugin.cpp:1234      produce_block        ] Produced block 000000029795f452... #2 @ 2018-08-21T06:36:52.500 signed by eosio [trxs: 0, lib: 0, confirmed: 0]
2018-08-21T06:36:53.003 thread-0   producer_plugin.cpp:1234      produce_block        ] Produced block 00000003895b7073... #3 @ 2018-08-21T06:36:53.000 signed by eosio [trxs: 0, lib: 2, confirmed: 0]
2018-08-21T06:36:53.502 thread-0   producer_plugin.cpp:1234      produce_block        ] Produced block 00000004691e1021... #4 @ 2018-08-21T06:36:53.500 signed by eosio [trxs: 0, lib: 3, confirmed: 0]
2018-08-21T06:36:54.005 thread-0   producer_plugin.cpp:1234      produce_block        ] Produced block 000000059a84d840... #5 @ 2018-08-21T06:36:54.000 signed by eosio [trxs: 0, lib: 4, confirmed: 0]
2018-08-21T06:36:54.505 thread-0   producer_plugin.cpp:1234      produce_block        ] Produced block 000000067cc65718... #6 @ 2018-08-21T06:36:54.500 signed by eosio [trxs: 0, lib: 5, confirmed: 0]
2018-08-21T06:36:55.002 thread-0   producer_plugin.cpp:1234      produce_block        ] Produced block 00000007e89ca483... #7 @ 2018-08-21T06:36:55.000 signed by eosio [trxs: 0, lib: 6, confirmed: 0]
2018-08-21T06:36:55.500 thread-0   producer_plugin.cpp:1234      produce_block        ] Produced block 0000000882e5aef6... #8 @ 2018-08-21T06:36:55.500 signed by eosio [trxs: 0, lib: 7, confirmed: 0]
2018-08-21T06:36:56.003 thread-0   producer_plugin.cpp:1234      produce_block        ] Produced block 000000098ce5a814... #9 @ 2018-08-21T06:36:56.000 signed by eosio [trxs: 0, lib: 8, confirmed: 0]
2018-08-21T06:36:56.501 thread-0   producer_plugin.cpp:1234      produce_block        ] Produced block 0000000a0bbdd045... #10 @ 2018-08-21T06:36:56.500 signed by eosio [trxs: 0, lib: 9, confirmed: 0]

开始正常出块,环境搭建完成。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 211,194评论 6 490
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,058评论 2 385
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 156,780评论 0 346
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,388评论 1 283
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,430评论 5 384
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,764评论 1 290
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,907评论 3 406
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,679评论 0 266
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,122评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,459评论 2 325
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,605评论 1 340
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,270评论 4 329
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,867评论 3 312
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,734评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,961评论 1 265
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,297评论 2 360
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,472评论 2 348

推荐阅读更多精彩内容