本文讲述在ubuntu16.04虚拟机下面安装最新的eos的过程,感觉比以太坊要复杂一些。eos现在只能从源代码编译安装,而不能用apt-get的方式进行安装。需要注意的一点是需要修改内存限制。默认的最低内存是7G,虚拟机只分配了5G内存。

1 用git下载eos源代码

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

2 修改内存限制

打开eos/scripts/eosio_build_ubuntu.sh,有这句话

if [ "${MEM_MEG}" -lt 7000 ]; then

这句里面的7000改成4000。

OS_VER=$( grep VERSION_ID /etc/os-release | cut -d'=' -f2 | sed 's/[^0-9\.]//gI' )OS_MAJ=$(echo "${OS_VER}" | cut -d'.' -f1)OS_MIN=$(echo "${OS_VER}" | cut -d'.' -f2)MEM_MEG=$( free -m | sed -n 2p | tr -s ' ' | cut -d\  -f2 || cut -d' ' -f2 )CPU_SPEED=$( lscpu | grep -m1 "MHz" | tr -s ' ' | cut -d\  -f3 || cut -d' ' -f3 | cut -d'.' -f1 )CPU_CORE=$( lscpu | grep "^CPU(s)" | tr -s ' ' | cut -d\  -f2 || cut -d' ' -f2 )MEM_GIG=$(( ((MEM_MEG / 1000) / 2) ))JOBS=$(( MEM_GIG > CPU_CORE ? CPU_CORE : MEM_GIG ))DISK_INSTALL=$(df -h . | tail -1 | tr -s ' ' | cut -d\  -f1 || cut -d' ' -f1)DISK_TOTAL_KB=$(df . | tail -1 | awk '{print $2}')DISK_AVAIL_KB=$(df . | tail -1 | awk '{print $4}')DISK_TOTAL=$(( DISK_TOTAL_KB / 1048576 ))DISK_AVAIL=$(( DISK_AVAIL_KB / 1048576 ))printf "\\n\\tOS name: %s\\n" "${OS_NAME}"printf "\\tOS Version: %s\\n" "${OS_VER}"printf "\\tCPU speed: %sMhz\\n" "${CPU_SPEED}"printf "\\tCPU cores: %s\\n" "${CPU_CORE}"printf "\\tPhysical Memory: %s Mgb\\n" "${MEM_MEG}"printf "\\tDisk install: %s\\n" "${DISK_INSTALL}"printf "\\tDisk space total: %sG\\n" "${DISK_TOTAL%.*}"printf "\\tDisk space available: %sG\\n" "${DISK_AVAIL%.*}"if [ "${MEM_MEG}" -lt 7000 ]; thenprintf "\\tYour system must have 7 or more Gigabytes of physical memory installed.\\n"printf "\\tExiting now.\\n"exit 1ficase "${OS_NAME}" in

3 执行eos目录下的编译脚本eosio_build.sh

~/eos$ sudo ./eosio_build.sh

这个过程会下载大量的依赖库,用时要俩个小时左右。成功后会显示界面:

 _______  _______  _______ _________ _______(  ____ \(  ___  )(  ____ \\__   __/(  ___  )| (    \/| (   ) || (    \/   ) (   | (   ) || (__    | |   | || (_____    | |   | |   | ||  __)   | |   | |(_____  )   | |   | |   | || (      | |   | |      ) |   | |   | |   | || (____/\| (___) |/\____) |___) (___| (___) |(_______/(_______)\_______)\_______/(_______)EOS.IO has been successfully built. 0:32:57To verify your installation run the following commands:/home/liuwenbin/opt/mongodb/bin/mongod -f /home/liuwenbin/opt/mongodb/mongod.conf &cd /home/liuwenbin/eos/build; make testFor more information:EOS.IO website: https://eos.ioEOS.IO Telegram channel @ https://t.me/EOSProjectEOS.IO resources: https://eos.io/resources/EOS.IO wiki: https://github.com/EOSIO/eos/wiki

4 执行安装

进入build目录,执行下面命令

~/eos/build$ sudo make install

安装完成后会在 /usr/local/eosio/bin下生成 cleos、kesod、nodeos等可执行文件。

/usr/local/eosio/bin$ ls
cleos  eosio-abigen  eosiocpp  eosio-launcher  eosio-s2wasm  eosio-wast2wasm  keosd  nodeos

5 设置PATH路径

上面步骤会在 /usr/local下面生成 eosio 文件夹。打开 /etc/profile 文件,添加 ./usr/local/eosio/bin 目录到PATH变量中

export PATH=/usr/local/eosio/bin:$PATH

6 启动nodeos节点

首先准备一个genesis.json,文件就保存在eos目录下,文件内容我用的是:

{"initial_timestamp": "2018-03-01T12:00:00.000","initial_key": "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","initial_configuration": {"base_per_transaction_net_usage": 100,"base_per_transaction_cpu_usage": 500,"base_per_action_cpu_usage": 1000,"base_setcode_cpu_usage": 2097152,"per_signature_cpu_usage": 100000,"per_lock_net_usage": 32,"context_free_discount_cpu_usage_num": 20,"context_free_discount_cpu_usage_den": 100,"max_transaction_cpu_usage": 10485760,"max_transaction_net_usage": 104857,"max_block_cpu_usage": 104857600,"target_block_cpu_usage_pct": 1000,"max_block_net_usage": 1048576,"target_block_net_usage_pct": 1000,"max_transaction_lifetime": 3600,"max_transaction_exec_time": 0,"max_authority_depth": 6,"max_inline_depth": 4,"max_inline_action_size": 4096,"max_generated_transaction_count": 16},"initial_chain_id": "0000000000000000000000000000000000000000000000000000000000000000"
}

然后执行命令启动nodeos节点:

nodeos -e -p eosio --plugin eosio::wallet_api_plugin --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin --genesis-json genesis.json

运行界面如下:

可以看到这个节点在不停的产生区块,周期是0.5s左右。

区块数据保存在目录 ~/.local/share/eosio/nodeos/data下面。

只有第一次启动时需要用--genesis-json选项,以后启动时不要再带这个选项,否则会报错。

7 通过config.ini文件来启动节点

除了上面的用命令行来出块的方式,还可以通过配置config.ini文件的方式来启动nodeos节点。新建一个文件夹,创建一个genesis.json,内容和上节的一样。然后再创建一个config.ini文件,文件内容如下:

genesis-json = genesis.json
block-log-dir = blocks
readonly = 0
send-whole-blocks = true
shared-file-dir = blockchain
shared-file-size = 8192
unlock-timeout = 90000
bnet-endpoint = 0.0.0.0:4321
http-server-address = 0.0.0.0:8888
p2p-listen-endpoint = 0.0.0.0:9876
p2p-server-address = localhost:9876
allowed-connection = any
#p2p-peer-address = localhost:9877
required-participation = true
signature-provider = EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV=KEY:5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
producer-name = eosio
plugin = eosio::producer_plugin
plugin = eosio::chain_api_plugin
plugin = eosio::history_api_plugin
plugin = eosio::wallet_api_plugin
plugin = eosio::http_plugin
enable-stale-production = true

基本上命令行中可用的命令,都可以去掉前缀的--后然后直接用到config.ini中。比如命令行中的 -e,对应配置文件中的

enable-stale-production = true,即允许出块;命令行中的 -p eosio,在配置文件里可以写成 producer-name = eosio;命令行中的--plugin eosio::wallet_api_plugin --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin,在配置文件中可以写成:

plugin = eosio::chain_api_plugin
plugin = eosio::history_api_plugin
plugin = eosio::wallet_api_plugin

此外配置文件还可以配置

创建好genesis.json和config.ini后的文件夹:

~/eostest1$ ls
config.ini  genesis.json

然后启动nodeos节点:

~/eostest1$ sudo nodeos --data-dir ./ --config-dir ./

节点启动起来了:

~/eostest1$ sudo nodeos --data-dir ./ --config-dir ./
2018-08-02T07:05:46.108 thread-0   chain_plugin.cpp:271          plugin_initialize    ] initializing chain plugin
2018-08-02T07:05:46.150 thread-0   block_log.cpp:124             open                 ] Log is nonempty
2018-08-02T07:05:46.151 thread-0   block_log.cpp:142             open                 ] Index is nonempty
2018-08-02T07:05:46.172 thread-0   http_plugin.cpp:344           plugin_initialize    ] configured http to listen on 0.0.0.0:8888
2018-08-02T07:05:46.172 thread-0   wallet_plugin.cpp:42          plugin_initialize    ] initializing wallet plugin
2018-08-02T07:05:46.172 thread-0   wallet_api_plugin.cpp:123     plugin_initialize    ] 2018-08-02T07:05:46.172 thread-0   net_plugin.cpp:2919           plugin_initialize    ] Initialize net plugin
2018-08-02T07:05:46.172 thread-0   net_plugin.cpp:2944           plugin_initialize    ] host: 0.0.0.0 port: 9876
2018-08-02T07:05:46.173 thread-0   net_plugin.cpp:3014           plugin_initialize    ] my node_id is 2eeb56eff4165c28fe8a5e6e94113d3f066094d533606384e6758ecaef713cd3
2018-08-02T07:05:46.173 thread-0   main.cpp:105                  main                 ] nodeos version 40a20769
2018-08-02T07:05:46.173 thread-0   main.cpp:106                  main                 ] eosio root is /home/lzj/.local/share
2018-08-02T07:05:46.173 thread-0   chain_plugin.cpp:596          plugin_startup       ] starting chain in read/write mode
2018-08-02T07:05:46.173 thread-0   chain_plugin.cpp:600          plugin_startup       ] Blockchain started; head block is #3, genesis timestamp is 2018-06-01T12:00:00.000
2018-08-02T07:05:46.173 thread-0   producer_plugin.cpp:640       plugin_startup       ] producer plugin:  plugin_startup() begin
2018-08-02T07:05:46.173 thread-0   producer_plugin.cpp:658       plugin_startup       ] Launching block production for 1 producers at 2018-08-02T07:05:46.173.
2018-08-02T07:05:46.173 thread-0   producer_plugin.cpp:670       plugin_startup       ] producer plugin:  plugin_startup() end
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:401           plugin_startup       ] start listening for http requests
2018-08-02T07:05:46.173 thread-0   chain_api_plugin.cpp:75       plugin_startup       ] starting chain_api_plugin
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/abi_bin_to_json
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/abi_json_to_bin
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_abi
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_account
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_block
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_block_header_state
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_code
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_currency_balance
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_currency_stats
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_info
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_producer_schedule
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_producers
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_raw_code_and_abi
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_required_keys
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_scheduled_transactions
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/get_table_rows
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/push_block
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/push_transaction
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/chain/push_transactions
2018-08-02T07:05:46.173 thread-0   history_api_plugin.cpp:38     plugin_startup       ] starting history_api_plugin
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/history/get_actions
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/history/get_controlled_accounts
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/history/get_key_accounts
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/history/get_transaction
2018-08-02T07:05:46.173 thread-0   wallet_api_plugin.cpp:73      plugin_startup       ] starting wallet_api_plugin
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/wallet/create
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/wallet/create_key
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/wallet/get_public_keys
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/wallet/import_key
2018-08-02T07:05:46.173 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/wallet/list_keys
2018-08-02T07:05:46.174 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/wallet/list_wallets
2018-08-02T07:05:46.174 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/wallet/lock
2018-08-02T07:05:46.174 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/wallet/lock_all
2018-08-02T07:05:46.174 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/wallet/open
2018-08-02T07:05:46.174 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/wallet/remove_key
2018-08-02T07:05:46.174 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/wallet/set_timeout
2018-08-02T07:05:46.174 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/wallet/sign_digest
2018-08-02T07:05:46.174 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/wallet/sign_transaction
2018-08-02T07:05:46.174 thread-0   http_plugin.cpp:447           add_handler          ] add api url: /v1/wallet/unlock
2018-08-02T07:05:46.174 thread-0   net_plugin.cpp:3027           plugin_startup       ] starting listener, max clients is 25
2018-08-02T07:05:46.502 thread-0   producer_plugin.cpp:1196      produce_block        ] Produced block 00000004141690fd... #4 @ 2018-08-02T07:05:46.500 signed by eosio [trxs: 0, lib: 3, confirmed: 0]
2018-08-02T07:05:47.002 thread-0   producer_plugin.cpp:1196      produce_block        ] Produced block 00000005c6ea9393... #5 @ 2018-08-02T07:05:47.000 signed by eosio [trxs: 0, lib: 4, confirmed: 0]
2018-08-02T07:05:47.502 thread-0   producer_plugin.cpp:1196      produce_block        ] Produced block 00000006331daf2d... #6 @ 2018-08-02T07:05:47.500 signed by eosio [trxs: 0, lib: 5, confirmed: 0]
2018-08-02T07:05:48.002 thread-0   producer_plugin.cpp:1196      produce_block        ] Produced block 00000007a97091c1... #7 @ 2018-08-02T07:05:48.000 signed by eosio [trxs: 0, lib: 6, confirmed: 0]
2018-08-02T07:05:48.501 thread-0   producer_plugin.cpp:1196      produce_block        ] Produced block 0000000833bd7cff... #8 @ 2018-08-02T07:05:48.500 signed by eosio [trxs: 0, lib: 7, confirmed: 0]
2018-08-02T07:05:49.004 thread-0   producer_plugin.cpp:1196      produce_block        ] Produced block 00000009615fae7f... #9 @ 2018-08-02T07:05:49.000 signed by eosio [trxs: 0, lib: 8, confirmed: 0]
2018-08-02T07:05:49.534 thread-0   producer_plugin.cpp:1196      produce_block        ] Produced block 0000000a09f88d83... #10 @ 2018-08-02T07:05:49.500 signed by eosio [trxs: 0, lib: 9, confirmed: 0]
2018-08-02T07:05:50.001 thread-0   producer_plugin.cpp:1196      produce_block        ] Produced block 0000000bba286721... #11 @ 2018-08-02T07:05:50.000 signed by eosio [trxs: 0, lib: 10, confirmed: 0]

ubuntu16.04安装eos相关推荐

  1. ubuntu16.04安装opencv3.4.1教程

    最近opencv3.4.1发布了,想换个新的试试鲜,于是把配置的过程通过博文的方式记录下来,方便查阅.  本教程原为3.3.0,但经过博主亲测,3.4.0.3.4.1皆适用 1.去官网下载opencv ...

  2. Ubuntu16.04 安装ftp

    2019独角兽企业重金招聘Python工程师标准>>> Ubuntu16.04 安装ftp,根据依赖安装. 安装vsftpd. sudo apt-get install vsftpd ...

  3. ubuntu16.04 安装CAJViewer 以及 安装wine /deepin-wine 图标异常的解决

    ubuntu16.04 安装CAJViewer 以及 安装wine /deepin-wine 图标异常的解决 通过deepin-wine 安装 cajviewer 之前装过deepin-wine 所以 ...

  4. ubuntu16.04 安装微信和qq

    ubuntu16.04 安装微信和qq Ubuntu系统没有qq和微信很难受,所以前几天装了一下qq和微信,在此记录下来,以防忘记. 通过 https://github.com/wszqkzqk/de ...

  5. Ubuntu16.04安装Chrome浏览器及解决root不能打开的问题

    Ubuntu16.04安装Chrome浏览器及解决root不能打开的问题 参考文章: (1)Ubuntu16.04安装Chrome浏览器及解决root不能打开的问题 (2)https://www.cn ...

  6. Linux入门(7)——Ubuntu16.04安装wps并解决系统缺失字体问题

    Linux入门(7)--Ubuntu16.04安装wps并解决系统缺失字体问题 参考文章: (1)Linux入门(7)--Ubuntu16.04安装wps并解决系统缺失字体问题 (2)https:// ...

  7. ubuntu16.04安装CUDA 8.0(很详尽,包括一些坑的解决方法)

    ubuntu16.04安装CUDA 8.0(很详尽,包括一些坑的解决方法) 参考文章: (1)ubuntu16.04安装CUDA 8.0(很详尽,包括一些坑的解决方法) (2)https://www. ...

  8. ubuntu16.04安装英伟达(NVIDIA)驱动——run文件安装

    ubuntu16.04安装英伟达(NVIDIA)驱动--run文件安装 去官网http://www.nvidia.com/Download/index.aspx?lang=en-us选择显卡驱动 中文 ...

  9. ubuntu16.04安装torch

    ubuntu16.04安装torch 第一步:从git上获取安装LuaJIT(C语言编写的Lua的解释器)和Torch所必需的依赖包: 在终端执行:git clone https://github.c ...

最新文章

  1. jpanel不使用jframe保存的图片为空_使用DataBinding还在为数据处理头疼?这篇文章帮你解决问题
  2. RfD-Net:基于语义实例重构的点云场景理解(CVPR2021)
  3. 2019全国普通高校学科竞赛排行榜发布
  4. Django-Model操作数据库(增删改查、连表结构)参考
  5. 天猫不搞双十一“开玩笑”
  6. http://acm.hrbeu.edu.cn/index.php?act=problemid=1001cid=19 人工湖的公路
  7. php字符串赋值给变量,JavaScript-如何将一个PHP字符串安全赋值给Javascript变量(包含引号和换行符的)...
  8. 用模版实现简单的内存池
  9. 【CodeForces - 264A】Escape from Stones (模拟,卡精度的处理)
  10. 设计一个成功的微服务,堪称必备的9大基础知识
  11. mongo 主从数据不同步
  12. eclipse代码自动提示,eclipse设置代码自动提示
  13. Android帧缓冲区(Frame Buffer)硬件抽象层(HAL)模块Gralloc的实现原理分析(8)...
  14. Mysql数据库规范(阿里巴巴嵩山版java开发手册)
  15. 【舆情监控】社会化大数据应用平台TOOM舆情监测系统
  16. xsmax进入dfu模式_如何在iPhone XR,iPhone XS和XS Max,iPhone X上进入恢复模式
  17. 使用uniapp开发微信小程序的人脸采集功能/人脸识别功能
  18. android app银联支付,android app 快速接入银联支付流程(android studio版)
  19. outlook 默认打开ie_如何使用OUTLOOK联系人取代手机联系人,实现电脑和手机联系人、日历、待办的同步...
  20. matlab取矩阵元素的模,Matlab矩阵元素提取

热门文章

  1. 猪齿鱼数智化效能平台亮相 2021 中国开源年会
  2. Unity2D角色跳跃
  3. 【AE表达式】以编程的方式使用AE
  4. 2022-卷王杯-happyFastjson
  5. 瑞盟RS-485接口电路MS3485代替MAX3485/SP3485
  6. 蒟蒻のgolang小窝(gin整合gorm完成一次清单实战~)
  7. 在PPT2007中制作礼花绽放动画效果ppt模板打包下载
  8. 学习 Java 的正确姿势
  9. 一张图解释什么是遗传算法_遗传算法总结(#看了就能懂和用系列#)
  10. #今日论文推荐# 死蜘蛛转世成为机械臂:人们求之不得的微型气动抓手来了