首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

从零到壹学习EOS 第一讲:搭建EOS开发环境

支持的操作系统

Amazon 2017.09 and higher

Centos 7

Fedora 25 and higher (Fedora 27 recommended)

Mint 18

Ubuntu 16.04 (Ubuntu 16.10 recommended)

MacOS Darwin 10.12 and higher (MacOS 10.13.x recommended)

mac 基础环境

# 安装 xcodexcode-select --install# 安装 Homebrewruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

获取并编译 EOS

下载 eos

$ git clone https://github.com/eosio/eos --recursive$ cd eos$ git checkout dawn-v3.0.0

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

$ git submodule update --init --recursive

编译源码生成可执行文件

$ ./eosio_build.sh

编译时间比较长,需要耐心等待,大约30分钟~50分钟,编译成功:

附带的可执行程序:

: 区块链服务器节点生成组建

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

: EOS 钱包

:节点网络组成和部署的应用

所有这些程序都存在于这个文件夹

mac 下遇到的问题

CMake Error at /usr/local/Cellar/cmake/3.11.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):Failed to find Gettext libintl (missing: Intl_INCLUDE_DIR)Call Stack (most recent call first):/usr/local/Cellar/cmake/3.11.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)/usr/local/Cellar/cmake/3.11.1/share/cmake/Modules/FindIntl.cmake:47 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)programs/cleos/CMakeLists.txt:29 (find_package)

解决方法:brew unlink gettext && brew link --force gettext

运行一个单节点网络

$ cd build/programs/nodeos$ ./nodeos

如下图所示,执行完./nodeos程序后会抱错

出现上面错误,我们需要配置一下config.ini

Mac OS: ~/Library/Application Support/eosio/nodeos/config

Linux: ~/.local/share/eosio/nodeos/config

$ cd ~/Library/Application\ Support/eosio/nodeos/config$ lsconfig.inigenesis.jsonvi 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 = "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# plugin = # 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

修改完 ,然后重新进入 执行 ``

$ cd /Users/fujinliang/workspace/eos/build/programs/nodeos/$ ./nodeos

运行成功,结果如下:

查看区块信息

进入 目录,执行 可以查询区块的信息

$ cd /Users/fujinliang/workspace/eos/build/programs/cleos$ ./cleos get info{ "server_version": "d9ad8eec", "head_block_num": 104, "last_irreversible_block_num": 103, "head_block_id": "0000006820981a892839ba2789e50e18d10acef786cf7b561d3a0c681275008a", "head_block_time": "2018-04-28T08:59:05", "head_block_producer": "eosio"}

参考资料

https://github.com/EOSIO/eos/issues/2028

  • 发表于:
  • 原文链接http://kuaibao.qq.com/s/20180511G27XLK00?refer=cp_1026
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券