http://mp.weixin.qq.com/s/RcDFCFCWpMIIAshJMqkxxw ,地址实效,请关注公众号

一下引用,只是技术记录交流

目前来讲,学习任何EOS相关技术的资料都来自https://github.com/EOSIO/eos,大家可能在搭建EOS开发环境的过程中,会很迷茫,网上资料都很乱,自己也理不清头绪,不知如何下手。在这里,春哥将一步步为你揭开层层面纱。

1.硬件软件环境

因为EOS的版本太多,你所以先需要知道如何查看EOS对应版本的相关资料。

打开EOS Github官网https://github.com/EOSIO/eos,如下图所示,点击master,然后点击tag,你将会看到不同的版本及其对应的文档。

我在我电脑安装过各种各样的版本,踩过各种各样的莫名其妙的坑,这篇文章我将以如下配置为大家分享。

  • 操作系统

  • EOS 版本

2.编译设置开发环境

2.1获取EOS源码及其所有子模块

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

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

$ git submodule update --init --recursive

2.2编译源码生成可执行文件

切换到上面的项目根目录下面,执行如下命令。

liyuechun:eos yuechunli$ ./eosio_build.sh darwin full
liyuechun:eos yuechunli$ ls
CMakeLists.txt debian ring.dot
CMakeModules docs ring.png
Docker eos-logo.png scripts
Doxyfile eos.doxygen.in star.dot
HEADER eosio_build.sh star.png
Jenkinsfile externals testnet-diagrams.sh
LICENSE.txt libraries testnet.md
README.md mesh.dot testnet.templatebuild mesh.png tests
circle.yml plugins tools
contracts programs
liyuechun:eos yuechunli$ ./eosio_build.sh darwin full Beginning build version: 1.2
2018年 4月12日 星期四 07时44分06秒 UTC
git head id: 96ee0325cc925ff3e90f865ebc72b01341196e08
Current branch: * master ARCHITECTURE: Darwin OS name: Darwin
OS Version: 10.13.3
CPU speed: 250.00Ghz
CPU cores: 4
Physical Memory: 16 Gbytes
Disk space total: 465G
Disk space available: 133G
.....
漫长等待,半小时左右,网络不好的话,40 - 50分钟。
[100%] Linking CXX executable chain_test
ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in code signed PIE, but used in ___gmpn_divexact_1 from /usr/local/lib/libgmp.a(dive_1.o). To fix this warning, don't compile with -mdynamic-no-pic or link with -Wl,-no_pie
[100%] Built target chain_test _______  _______  _______ _________ _______ (  ____ \(  ___  )(  ____ \\__   __/(  ___  )
| (    \/| (   ) || (    \/   ) (   | (   ) |
| (__    | |   | || (_____    | |   | |   | |
|  __)   | |   | |(_____  )   | |   | |   | |
| (      | |   | |      ) |   | |   | |   | |
| (____/\| (___) |/\____) |___) (___| (___) | (_______/(_______)\_______)\_______/(_______) EOS.IO has been successfully built. 0:11:48 To verify your installation run the following commands: /usr/local/bin/mongod -f /usr/local/etc/mongod.conf &
cd /Users/liyuechun/eos/build; make test For more information:
EOS.IO website: https://eos.io
EOS.IO Telegram channel @ https://t.me/EOSProject
EOS.IO resources: https://eos.io/resources/
EOS.IO wiki: https://github.com/EOSIO/eos/wiki

EOS附带的可执行程序:

liyuechun:programs yuechunli$ pwd
/Users/liyuechun/Desktop/0402/eos/build/programsliyuechun:programs yuechunli$ lsCMakeFiles cmake_install.cmake keosdCTestTestfile.cmake eosio-abigen nodeosMakefile eosio-applesedemo
cleos eosio-launcherliyuechun:programs yuechunli$
  • nodeos: 区块链服务器节点生成组建

  • cleos: 和区块链交互的接口命令

  • keosd: EOS 钱包

  • eosio-launcher:节点网络组成和部署的应用

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

2.3建立区块链节点

到e月刊目录eos/build/programs/nodeos下面,然后执行如下命令。

./nodeos柯林斯命令附带  --data-dir 节点文件夹名字 参数,默认文件夹为nodeos

liyuechun:nodeos yuechunli$ ./nodeos

如下图所示,完执行./nodeos程序后会抱错,并且有如下两个提示。

generating default genesis file /Users/liyuechun/Library/Application Support/eosio/nodeos/config/genesis.json创建³³表示了一个nodeos节点文件夹数。

No producers configured! Please add producer IDs and private keys to configuration.表示

liyuechun:nodeos yuechunli$ cd /Users/liyuechun/Library/Application\ Support/eosio/liyuechun:eosio yuechunli$ ls
nodeosliyuechun:eosio yuechunli$ cd nodeos/liyuechun:nodeos yuechunli$ ls
config dataliyuechun:nodeos yuechunli$ cd config/liyuechun:config yuechunli$ ls
config.ini genesis.jsonliyuechun:config yuechunli$ cd ..liyuechun:nodeos yuechunli$ ls
config dataliyuechun:nodeos yuechunli$ cd data/liyuechun:data yuechunli$ ls
blocks default.wallet shared_memliyuechun:data yuechunli$

config是区块链配置文件,data是区块链交易数据,钱包数据存储文件。需要我们修改config.ini文件里面的相关配置。

我的文件的内容如下:

# Track only transactions whose scopes involve the listed accounts. Default is to track all transactions. (eosio::account_history_plugin)# filter_on_accounts =# Limits the maximum time (in milliseconds) processing a single get_transactions call. (eosio::account_history_plugin)get-transactions-time-limit = 3# File to read Genesis State from (eosio::chain_plugin)genesis-json = "/Users/liyuechun/Library/Application Support/eosio/nodeos/config/genesis.json"# override the initial timestamp in the Genesis State file (eosio::chain_plugin)# genesis-timestamp =# the location of the block log (absolute path or relative to application data dir) (eosio::chain_plugin)block-log-dir = "blocks"# Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints. (eosio::chain_plugin)# checkpoint =# Limits the maximum time (in milliseconds) that a reversible block is allowed to run before being considered invalid (eosio::chain_plugin)max-reversible-block-time = -1# Limits the maximum time (in milliseconds) that is allowed a pushed transaction's code to execute before being considered invalid (eosio::chain_plugin)max-pending-transaction-time = -1# Limits the maximum time (in milliseconds) that is allowed a to push deferred transactions at the start of a block (eosio::chain_plugin)max-deferred-transaction-time = 20# Override default WASM runtime (eosio::chain_plugin)# wasm-runtime =# Time to wait, in milliseconds, between creating next faucet created account. (eosio::faucet_testnet_plugin)faucet-create-interval-ms = 1000# Name to use as creator for faucet created accounts. (eosio::faucet_testnet_plugin)faucet-name = faucet# [public key, WIF private key] for signing for faucet creator account (eosio::faucet_testnet_plugin)faucet-private-key = ["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]# The local IP and port to listen for incoming http connections. (eosio::http_plugin)http-server-address = 127.0.0.1:8888# Specify the Access-Control-Allow-Origin to be returned on each request. (eosio::http_plugin)# access-control-allow-origin =# Specify the Access-Control-Allow-Headers to be returned on each request. (eosio::http_plugin)# access-control-allow-headers =# Specify if Access-Control-Allow-Credentials: true should be returned on each request. (eosio::http_plugin)access-control-allow-credentials = false# The queue size between nodeos and MongoDB plugin thread. (eosio::mongo_db_plugin)mongodb-queue-size = 256# MongoDB URI connection string, see: https://docs.mongodb.com/master/reference/connection-string/. If not specified then plugin is disabled. Default database 'EOS' is used if not specified in URI. (eosio::mongo_db_plugin)# mongodb-uri =# The actual host:port used to listen for incoming p2p connections. (eosio::net_plugin)p2p-listen-endpoint = 0.0.0.0:9876# An externally accessible host:port for identifying this node. Defaults to p2p-listen-endpoint. (eosio::net_plugin)# p2p-server-address =# The public endpoint of a peer node to connect to. Use multiple p2p-peer-address options as needed to compose a network. (eosio::net_plugin)# p2p-peer-address =# The name supplied to identify this node amongst the peers. (eosio::net_plugin)agent-name = "EOS Test Agent"# Can be 'any' or 'producers' or 'specified' or 'none'. If 'specified', peer-key must be specified at least once. If only 'producers', peer-key is not required. 'producers' and 'specified' may be combined. (eosio::net_plugin)allowed-connection = any# Optional public key of peer allowed to connect.  May be used multiple times. (eosio::net_plugin)# peer-key =# Tuple of [PublicKey, WIF private key] (may specify multiple times) (eosio::net_plugin)# peer-private-key =# Log level: one of 'all', 'debug', 'info', 'warn', 'error', or 'off' (eosio::net_plugin)log-level-net-plugin = info# Maximum number of clients from which connections are accepted, use 0 for no limit (eosio::net_plugin)max-clients = 25# number of seconds to wait before cleaning up dead connections (eosio::net_plugin)connection-cleanup-period = 30# True to require exact match of peer network version. (eosio::net_plugin)network-version-match = 0# number of blocks to retrieve in a chunk from any individual peer during synchronization (eosio::net_plugin)sync-fetch-span = 100# Enable block production, even if the chain is stale. (eosio::producer_plugin)enable-stale-production = true# Percent of producers (0-100) that must be participating in order to produce blocks (eosio::producer_plugin)required-participation = 33# ID of producer controlled by this node (e.g. inita; may specify multiple times) (eosio::producer_plugin)producer-name = eosio# Tuple of [public key, WIF private key] (may specify multiple times) (eosio::producer_plugin)private-key = ["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]# The path of the wallet files (absolute path or relative to application data dir) (eosio::wallet_plugin)wallet-dir = "."# Timeout for unlocked wallet in seconds. Wallets will automatically lock after specified number of seconds of inactivity. Activity is defined as any wallet command e.g. list-wallets. (eosio::wallet_plugin)# unlock-timeout =# eosio key that will be imported automatically when a wallet is created. (eosio::wallet_plugin)# eosio-key =# Plugin(s) to enable, may be specified multiple times# Load the block producer plugin, so you can produce blocksplugin = eosio::producer_plugin# Wallet pluginplugin = eosio::wallet_api_plugin# As well as API and HTTP pluginsplugin = eosio::chain_api_pluginplugin = eosio::http_plugin

你需要做如下设置:

  • genesis-json = "/Users/liyuechun/Library/Application Support/eosio/nodeos/config/genesis.json"

  • enable-stale-production = true

  • producer-name = eosio

  • plugin = eosio::producer_plugin

  • plugin = eosio::wallet_api_plugin

  • plugin = eosio::chain_api_plugin

  • plugin = eosio::http_plugin

再次接下来启动./nodeos程序,每0.5秒会产生一个区块。

liyuechun:nodeos yuechunli$ ./nodeos
2212313ms thread-0   chain_plugin.cpp:99           plugin_initialize    ] initializing chain plugin2212313ms thread-0   wallet_plugin.cpp:41          plugin_initialize    ] initializing wallet plugin2212313ms thread-0   http_plugin.cpp:141           plugin_initialize    ] host: 127.0.0.1 port: 8888 2212313ms thread-0   http_plugin.cpp:144           plugin_initialize    ] configured http to listen on 127.0.0.1:88882212313ms thread-0   net_plugin.cpp:2628           plugin_initialize    ] Initialize net plugin2212313ms thread-0   net_plugin.cpp:2644           plugin_initialize    ] Setting net_plugin logging level to info2212313ms thread-0   net_plugin.cpp:2669           plugin_initialize    ] host: 0.0.0.0 port: 9876 2212313ms thread-0   net_plugin.cpp:2745           plugin_initialize    ] my node_id is e03436889c70950da2180e6bc3b215d4283d078a54723ca32cd28c816aa4621b2212313ms thread-0   main.cpp:90                   main                 ] nodeos version 96ee03252212313ms thread-0   main.cpp:91                   main                 ] eosio root is /Users/liyuechun/Library/Application Support2212329ms thread-0   chain_plugin.cpp:208          plugin_startup       ] starting chain in read/write mode2212329ms thread-0   chain_plugin.cpp:213          plugin_startup       ] Blockchain started; head block is #0, genesis timestamp is 2018-03-01T12:00:00.0002212329ms thread-0   producer_plugin.cpp:161       plugin_startup       ] producer plugin:  plugin_startup() begin2212329ms thread-0   producer_plugin.cpp:166       plugin_startup       ] Launching block production for 1 producers. *******************************
*                             *
*   ------ NEW CHAIN ------   *
*   -  Welcome to EOSIO!  -   *
*   -----------------------   *
*                             *
******************************* Your genesis seems to have an old timestamp
Please consider using the --genesis-timestamp option to give your genesis a recent timestamp2212330ms thread-0   producer_plugin.cpp:176       plugin_startup       ] producer plugin:  plugin_startup() end2212330ms thread-0   http_plugin.cpp:213           plugin_startup       ] start listening for http requests2212330ms thread-0   wallet_api_plugin.cpp:70      plugin_startup       ] starting wallet_api_plugin2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/wallet/create2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/wallet/get_public_keys2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/wallet/import_key2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/wallet/list_keys2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/wallet/list_wallets2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/wallet/lock2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/wallet/lock_all2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/wallet/open2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/wallet/set_timeout2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/wallet/sign_transaction2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/wallet/unlock2212330ms thread-0   chain_api_plugin.cpp:62       plugin_startup       ] starting chain_api_plugin2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/chain/abi_bin_to_json2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/chain/abi_json_to_bin2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/chain/get_account2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/chain/get_block2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/chain/get_code2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/chain/get_currency_balance2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/chain/get_currency_stats2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/chain/get_info2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/chain/get_required_keys2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/chain/get_table_rows2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/chain/push_block2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/chain/push_transaction2212330ms thread-0   http_plugin.cpp:242           add_handler          ] add api url: /v1/chain/push_transactions2212330ms thread-0   net_plugin.cpp:2757           plugin_startup       ] starting listener, max clients is 25eosio generated block b8001d13... #1 @ 2018-04-12T08:36:52.500 with 0 trxs, lib: 0eosio generated block 96eab818... #2 @ 2018-04-12T08:36:53.000 with 0 trxs, lib: 1eosio generated block 635d105b... #3 @ 2018-04-12T08:36:53.500 with 0 trxs, lib: 2eosio generated block 29ef0516... #4 @ 2018-04-12T08:36:54.000 with 0 trxs, lib: 3eosio generated block 1fc1ac75... #5 @ 2018-04-12T08:36:54.500 with 0 trxs, lib: 4eosio generated block 041d331f... #6 @ 2018-04-12T08:36:55.000 with 0 trxs, lib: 5eosio generated block ebee3c7d... #7 @ 2018-04-12T08:36:55.500 with 0 trxs, lib: 6eosio generated block eecd62a0... #8 @ 2018-04-12T08:36:56.000 with 0 trxs, lib: 7eosio generated block c2b27ea5... #9 @ 2018-04-12T08:36:56.500 with 0 trxs, lib: 8eosio generated block 6c66dc13... #10 @ 2018-04-12T08:36:57.000 with 0 trxs, lib: 9eosio generated block 2534614c... #11 @ 2018-04-12T08:36:57.500 with 0 trxs, lib: 10eosio generated block cce2934b... #12 @ 2018-04-12T08:36:58.000 with 0 trxs, lib: 11eosio generated block 0165d88b... #13 @ 2018-04-12T08:36:58.500 with 0 trxs, lib: 12eosio generated block fa240aa7... #14 @ 2018-04-12T08:36:59.000 with 0 trxs, lib: 13eosio generated block 2965e8d4... #15 @ 2018-04-12T08:36:59.500 with 0 trxs, lib: 14

3.查看区块信息

重新打开一个终端,切换到如下路径。

liyuechun:cleos yuechunli$ ./cleos -p 8888 get info
{  "server_version": "96ee0325",  "head_block_num": 342,  "last_irreversible_block_num": 341,  "head_block_id": "0000015609ca5ec4f237bbe49e8eb3aa36dbe8ecec86133340567dad5caf01ba",  "head_block_time": "2018-04-12T08:39:43",  "head_block_producer": "eosio"}
liyuechun:cleos yuechunli$ ./cleos -p 8888 get info
{  "server_version": "96ee0325",  "head_block_num": 359,  "last_irreversible_block_num": 358,  "head_block_id": "00000167a933b393bc3562ca2998080748a1ed24f79014848e7b0b34f2c0c429",  "head_block_time": "2018-04-12T08:39:51",  "head_block_producer": "eosio"}

5.视频获取方式

获取EOS公开课视频

添加莉莉老师微信:【kongyixueyuan】

EOS搭建的更多相关文章

  1. EOS主网搭建教程--&&--搭建节点--&&--搭建mongodb数据库

    EOS主网搭建教程: 1.git clone https://github.com/EOS-Mainnet/eos.git --recursive 2.cd eos 3.git tag (查看有哪些分 ...

  2. 1.EOS源码编译运行

    目前网络上都是针对老版EOS2.0源码编译的文章,我在mac上参考这些文章编译,最后发现根本就不对,最新版本只需一条命令(./eosio_build.sh,依赖库会自动安装的)即可.我根据这些文章手动 ...

  3. EOS源码分析:transaction的一生

    最近在处理智能合约的事务上链问题,发现其中仍旧有知识盲点.原有的认识是一个事务请求会从客户端设备打包签名,然后通过RPC传到非出块节点,广播给超级节点,校验打包到可逆区块,共识确认最后变为不可逆区块. ...

  4. EOS开发环境搭建

    EOS开发环境搭建   在上一篇文章<扒一扒EOS的前世今生>中,我们已经了解了EOS以及他的创始人Daniel Larimer的故事,本次为大家带来的是关于EOS开发环境搭建的内容.首先 ...

  5. Mac eos 环境搭建

    最近EOS官网出了文档,说可以跑通一个独立测试的节点了.这周尝试自行搭建了一下,由于自己不完全做mac下的开发,且这玩意是C写的,所以make起来遇到不少坑,记录下来.附完整踩坑.填坑记录. 1. 搭 ...

  6. EOS智能合约开发(一):EOS环境搭建和启动节点

    EOS和以太坊很像,EOS很明确的说明它就是一个区块链的操作系统,BM在博客中也是说过的. 可以这样比喻,EOS就相当于内置激励系统的Windows/Linux/MacOS,这是它的一个定位. 包括以 ...

  7. 搭建EOS环境

    [搭建EOS环境] 1.Ubuntu 18.04 下安装eosio wget https://github.com/eosio/eos/releases/download/v1.4.4/eosio_1 ...

  8. eos源码分析和应用(一)调试环境搭建

    转载自 http://www.limerence2017.com/2018/09/02/eos1/#more eos基于区块链技术实现的开源引擎,开发人员可以基于该引擎开发DAPP(分布式应用).下面 ...

  9. EOS Dapp开发(1)-基于Docker的开发环境搭建

    随着EOS主网的上线,相信基于EOS的Dapp开发会越来越多,查阅了很多资料相关的开发资料都不是很多,只能自己摸索,按照网上仅有的几篇教程,先git clonehttps://github.com/E ...

随机推荐

  1. Recurrent Neural Network[SRU]

    0.背景 对于如机器翻译.语言模型.观点挖掘.问答系统等都依赖于RNN模型,而序列的前后依赖导致RNN并行化较为困难,所以其计算速度远没有CNN那么快.即使不管训练的耗时程度,部署时候只要模型稍微大点 ...

  2. npm太慢, 淘宝npm镜像使用方法

    淘宝 npm 地址: http://npm.taobao.org/ 如何使用 有很多方法来配置npm的registry地址,下面根据不同情境列出几种比较常用的方法.以淘宝npm镜像举例: 1.临时使用 ...

  3. redis底层设计(四)——功能的实现

    redis中我们会经常用到事务.订阅与发布.Lua脚本以及慢查询日志,接下来我们就一一对他们进行探讨学习. 4.1事务 redis通过MULTI.DISCARD.EXEC和WATCH四个命令来实现事务 ...

  4. Spring Boot 2.0(八):Spring Boot 集成 Memcached

    Memcached 介绍 Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载.它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提高动态.数据库驱动网站 ...

  5. Python 学习 第十三篇:数据的读写-文件、DataFrame、json

    Python的文件是一个重要的对象,使用open()函数来打开文件,创建文件对象,进行文件的读写操作.当数据用于交换信息时,通常需要把数据保存为有格式的文本数据,可以保存为有特定的行分隔符和列分隔符的 ...

  6. Linux或Windows上实现端口映射

    通常服务器会有许多块网卡,因此也可能会连接到不同的网络,在隔离的网络中,某些服务可能会需要进行通信,此时服务器经过配置就可以承担起了转发数据包的功能. 一.Windows下实现端口映射 1. 查询端口 ...

  7. flink1.7自定义source实现

    flink读取source data 数据的来源是flink程序从中读取输入的地方.我们可以使用StreamExecutionEnvironment.addSource(sourceFunction) ...

  8. 通过 Systemd Journal 收集日志

    随着 systemd 成了主流的 init 系统,systemd 的功能也在不断的增加,比如对系统日志的管理.Systemd 设计的日志系统好处多多,这里笔者就不再赘述了,本文笔者主要介绍 syste ...

  9. C#.NET 大型通用信息化系统集成快速开发平台 4.1 版本 - 对外不要提供Delete方法加强软件的安全性

    1:软件系统一般不怕外面的人,最怕有内鬼.2:软件系统不怕一万,就怕万一,最好不要对外有漏洞,能不提供Delete方法就不提供.3:特别是不要有能远程调用的Delete方法,那就是出了事情都无法找到是 ...

  10. OO博客作业1:第1-3周作业总结

    (1)基于度量来分析自己的程序结构 注:UML图中每个划分了的圆角矩形代表一个类或接口,箭头可代表创建.访问数据等行为.类的图形内部分为3个部分,从上到下依次是类的名称.类包含的实例变量(属性).类实 ...