本地单节点Testnet

      成功构建项目后,nodeos二进制文件应存在于该build/programs/nodeos文件夹中。nodeos可以直接从build文件夹中运行programs/nodeos/nodeos,也可以cd programs/nodeos更改到文件夹并nodeos从那里运行命令。在这里,我们在programs/nodeos文件夹中运行命令。

您可以使用以下单个命令启动自己的单节点区块链:

cd build/programs/nodeos
./nodeos -e -p eosio --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin

运行时,nodeos您应该获得类似于下面的日志消息。这意味着块已成功生成。

1575001ms thread-0   chain_controller.cpp:235      _push_block          ] initm #1 @2017-09-04T04:26:15  | 0 trx, 0 pending, exectime_ms=0
1575001ms thread-0   producer_plugin.cpp:207       block_production_loo ] initm generated block #1 @ 2017-09-04T04:26:15 with 0 trxs  0 pending
1578001ms thread-0   chain_controller.cpp:235      _push_block          ] initc #2 @2017-09-04T04:26:18  | 0 trx, 0 pending, exectime_ms=0
1578001ms thread-0   producer_plugin.cpp:207       block_production_loo ] initc generated block #2 @ 2017-09-04T04:26:18 with 0 trxs  0 pending
...
eosio generated block 046b9984... #101527 @ 2018-04-01T14:24:58.000 with 0 trxs
eosio generated block 5e527ee2... #101528 @ 2018-04-01T14:24:58.500 with 0 trxs
...

此时,nodeos正在与一个生产者一起运行eosio

下图描绘了我们刚刚创建的单个主机testnet。 cleos用于管理钱包,管理帐户以及调用区块链上的操作。默认情况下,keosd启动cleos时执行钱包管理。

 

高级步骤

更高级的用户可能需要修改配置。 nodeos使用自定义配置文件夹。此文件夹的位置由您的系统决定。

  • 苹果系统: ~/Library/Application\ Support/eosio/nodeos/config
  • Linux的: ~/.local/share/eosio/nodeos/config

构建使用默认genesis.json文件为此文件夹设置种子。可以使用--config-dir命令行参数to 指定配置文件夹nodeos。如果使用此选项,则需要手动将genesis.json文件复制到config文件夹。

nodeos将需要一个正确配置的config.ini文件,以便做有意义的工作。在启动时,nodeos在config文件夹中查找config.ini。如果找不到,config.ini则创建默认文件。如果您还没有config.ini准备好使用的文件,请运行nodeos,然后立即使用<kbd> Ctrl-C </ kbd>将其关闭。config.ini将在config文件夹中创建默认配置()。编辑config.ini文件,将以下设置添加/更新为已有的默认值:

    # Enable production on a stale chain, since a single-node test chain is pretty much always stale
    enable-stale-production = true
    # Enable block production with the testnet producers
    producer-name = eosio
    # Load the block producer plugin, so you can produce blocks
    plugin = eosio::producer_plugin
    # As well as API and HTTP plugins
    plugin = eosio::chain_api_plugin
    plugin = eosio::http_plugin
   # This will be used by the validation step below, to view history
    plugin = eosio::history_api_plugin

现在它应该可以运行nodeos并看到它开始生成块。

 ./programs/nodeos/nodeos

nodeos将运行时数据(例如,共享内存和日志内容)存储在自定义数据文件夹中。此文件夹的位置由您的系统决定。

  • 苹果系统: ~/Library/Application\ Support/eosio/nodeos/data
  • Linux的: ~/.local/share/eosio/nodeos/data

可以使用--data-dir命令行参数指定数据文件夹nodeos

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值