手把手教你厘清EOS开发环境搭建来龙去脉

当前位置:首页 > 币圈百科 > 手把手教你厘清EOS开发环境搭建来龙去脉

手把手教你厘清EOS开发环境搭建来龙去脉

2023-02-03币圈百科251
目前来讲,任何学习黎明的女神相关技术的资料都来自https://github.com/EOSIO/eos,可能大家在搭建黎明的女神开发环境的过程中,会很迷茫,网上资料都很乱,自己也理不清头绪,不知怎么样下手。在这里,春哥将一步步为你揭开层层面纱x,x 1 .硬件软件环境

因为黎明的女神的版本太多,所以你需要先知道怎么样查看黎明的女神对应版本的相关资料

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

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

EOS?版本

2 .编译设置开发环境

2.1获取黎明的女神源码及其所有子模块

$ git克隆https://github.com/eosio/eos-递归

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

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

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

李月春:eos月春丽$。/EOS io _ build。达尔文完全同意。txtdebianring。dotcmakemodulesdocsring。pngdockeros-logo。pngscriptdoxyfileos。强力霉素。instar。dotheadereosio _ build。shstar。pngjenkinsfileexternalstestnet-图表。执照。txtlibrariestestnet。MD自述。MD网。dottestnet。templatebuildmesh。pngtestscircle。ymlpluginstoolscons/EOS io _ build。sh Darwin完全开始构建版本:1.22018年四月12日星期四07时44分06秒utc git head id:96ee 0325 cc 925 ff 3 e 90 f 865 ebc 72 b 01341196 e08当前分支:*主架构:达尔维诺斯名称:达尔维诺斯版本:10.13.3CPU速度:250.00GhzCPU核心数:4物理内存:16千兆字节磁盘磁盘空间总计:465克可用磁盘空间:133克.漫长等待,半小时左右,网络不好的话,40 - 50分钟100%]链接CXX可执行链_testld:警告:饼图禁用。绝对寻址(也许是-mdynamic-no-pic)在代码签名的馅饼中不允许,但在/usr/local/lib/lib GMP。a(dive _ 1。o)中的___gmpn_divexact_1中使用。要修复此警告,请不要使用-mdynamic-no-pic进行编译,也不要使用-Wl 、- no _ pie[100%]建立目标链_测试_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _(_ _ _ _ _ _ _)(_ _ _ _ _ _ _ \ _ _ _ _ _ _ _/(_ _ _ _ _ _)|(/)(|)|(_ _)|(_ _)| | | | |(_ _)| | | | |(_ _ _ _ _ _ _)| | | | | ^io已成功构建。0:11:48要验证您的安装,请运行以下命令:/usr/local/bin/mongod-f/usr/local/etc/mongod。 conf CD/Users/李越春/EOS/build;进行测试以获取更多信息:EOS .超正析象管(Image Orthicon)网址:https://eos.ioEOS.IO电报频道@ https://t.me/EOSProjectEOS.IO资源:https://EOS . IO/resources/EOS . IO wiki:https://github。com/EOS IO/EOS/wiki

EOS附带的可执行程序:

李月春:程序岳春里$残疾人/用户/李月春/桌面/0402/EOS/build/programs李悦君:程序岳春里$ lsCMakeFilescmake _ install。cmakeeosdctestfile。cmakeosio-abigenodeosmakefileoesio-apple sedemocleoseosio-launcherliyuejun:程序岳春里$ nodeos:区块链服务器节点生成组建cleos:和区块链交互的接口命令keosd:EOS?钱包eosio发射装置:节点网络组成和部署的应用

所有这些程序/EOS/构建/程序都存在于这个文件夹

2.3建立区块链节点

切换到目录Eos/构建/程序/节点操作系统(Operating System)下面,然后执行如下命令。x

./nodeos命令可附带?-数据目录节点文件夹名字?参数,默认文件夹为nodeos。

李月春:nodeos岳春丽$。/nodeos

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

生成默认发生文件/Users/李越春/库/应用程序支持/EOS io/nodeos/config/genesis。JSON表示创建了一个nodeos节点文件夹。x

没有配置生产者!请将生产者身份证明(identification)和私钥添加到配置中。表示

李月春:nodeos岳春丽$ CD/Users/李越春/图书馆/应用程序\支持/eosio/李越春:eosio岳春丽$ lsnodeos岳春丽$ CD nodeos/李月春:nodeos岳春丽$ lsconfigdataliyuechun:nodeos岳春丽$ cd config/liyuechun:config岳春丽$ lsconfig。ini创世纪。jsonliyue chun:config岳春丽$ CD.李月春:nodeos岳春丽$ lsconfigdataliyuechun:nodeos岳春丽$ CD数据/李月春:数据岳春丽$ lsblocksdefault。钱包共享_ memliyuechun:数据岳春丽$配置是区块链配置文件,数据是区块链交易数据、钱包数据存储文件。我们需要修改config.ini文件里面的相关配置

我的文件的内容如下:

#仅跟踪其范围涉及所列帐户的交易。默认设置是跟踪所有交易. eosio:account _ history _ plugin)# filter _ on _ accounts=#限制处理单个获取_交易调用的最长时间(以毫秒为单位)。(EOS io:account _ history _ plugin)get-transactions-time-limit=3 #从(EOS io:chain _ plugin)Genesis-JSON='/Users/liyue chun/Library/Application Support/EOS io/nodeos/config/Genesis。JSON ' #覆盖起源状态文件中的初始时间戳(EOS io:chain _ plugin)# Genesis-时间戳=#块日志的位置(绝对路径或相对于应用程序数据目录)(EOS io:chain _ plugin)BLOCK-log-dir=' blocks ' #对[BLOCK(EOS io:chain _ plugin)#检查点=#限制可逆块在被视为无效之前允许运行的最长时间(以毫秒为单位)(EOS io:chain _ plugin)max-reversible-block-Time=-1 #限制在被视为无效之前允许推送事务的代码执行的最长时间(以毫秒为单位)(EOS io:chain _ plugin)max-pending-transaction-Time=-1 #限制在块开始时允许推送延迟事务的最长时间(以毫秒为单位)(EOS io:chain _ plugin)max-deferred(EOS io:水龙头_测试网_插件)水龙头-创建-间隔-ms=1000#名称,用作水龙头创建帐户的创建者(eosio:水龙头_testnet_plugin)水龙头-名称=水龙头#[公钥,WIF私钥]用于水龙头创建者帐户(eosio:水龙头_testnet_plugin)水龙头-私钥=[' EOS 6 mryajqq 8 ud 7 hvnycfnvqcvpscn 5 so 8 bhthugyqet 5 GD w5 cv '' 5 qwrpbwdl 6 phxujxw 37 fssqz 1 jiw STS 4c qzdeyxtp 79 zkvfd 3 ']#监听传入超文本传送协议(Hyper Text Transport Protocol的缩写)连接的本地互联网协议(Internet Protocol)和端口(eosio:http _ plugin)http-server-address=127。0 .0 .1:8888 #指定每个请求要返回的访问控制允许来源.(eosio:http _ plugin)# Access-Control-Allow-origin=#指定在每个请求中返回的访问控制允许标题.(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 = trueproducer-name = eosioplugin = eosio::producer_pluginplugin = eosio::wallet_api_pluginplugin = eosio::chain_api_pluginplugin = 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 timestampPlease 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: 蓑衣网小编2022 /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: 蓑衣网小编2022 /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 蓑衣网小编2022 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"}
手把手教你厘清EOS开发环境搭建来龙去脉 | 分享给朋友: