EOS学习之路003--EOS主网同步

EOS学习之路003--EOS主网同步_第1张图片

上一节谈到启动了节点,通过cleos工具可以获取区块链状态

以上命令返回了以下内容:

server_version:版本

chain_id:网络编号,以上图片的网络编号是主网,但在未连接主网之前一定不是acaxxxxx开头的

head_block_num:头区块编号

last_irreversible_block_num:最后一个不可逆区块编号

.......

连接主网第一步,创建主网连接配置文件genesis.json

{
 "initial_timestamp": "2018-06-08T08:08:08.888",
 "initial_key": "EOS7EarnUhcyYqmdnPon8rm7mBCTnBoot6o7fE2WzjvEX2TdggbL3",
 "initial_configuration": {
  "max_block_net_usage": 1048576,
  "target_block_net_usage_pct": 1000,
  "max_transaction_net_usage": 524288,
  "base_per_transaction_net_usage": 12,
  "net_usage_leeway": 500,
  "context_free_discount_net_usage_num": 20,
  "context_free_discount_net_usage_den": 100,
  "max_block_cpu_usage": 200000,
  "target_block_cpu_usage_pct": 1000,
  "max_transaction_cpu_usage": 150000,
  "min_transaction_cpu_usage": 100,
   "max_transaction_lifetime": 3600,
   "deferred_trx_expiration_window": 600,
   "max_transaction_delay": 3888000,
   "max_inline_action_size": 4096,
   "max_inline_action_depth": 4,
   "max_authority_depth": 6
  }
}

将以上文件放到 build/programs/nodeos下面

第二步要加入配置信息,在配置文件config.ini 中添加p2p节点和插件

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

 Mac 路径:~/Library/Application\ Support/eosio/nodeos/config/ 

添加内容为1.p2p节点信息

p2p-peer-address = p2p.prod.eosgravity.com:80
p2p-peer-address =eu-west-nl.eosamsterdam.net:9876
p2p-peer-address =p2p.mainnet.eosgermany.online:9876
p2p-peer-address =54.38.250.15:19878
p2p-peer-address =p2p.genereos.io:9876
p2p-peer-address =mainnet.eospay.host:19876
p2p-peer-address =130.211.59.178:9876
p2p-peer-address =54.153.59.31:9999
p2p-peer-address =94.130.250.22:9806
p2p-peer-address =peer.main.alohaeos.com:9876
p2p-peer-address =peer.eosn.io:9876
p2p-peer-address =prod.mainnet.eos.cybex.io:9888
p2p-peer-address =p2p-1.eosnetwork.io:9876
p2p-peer-address =p.jeda.one:3322
p2p-peer-address =eosbattles.com:9877
p2p-peer-address =34.226.76.22:9876
p2p-peer-address =mainnet.eosoasis.io:9876
p2p-peer-address =node.eosflare.io:1883
p2p-peer-address =mainnet.eoscalgary.io:5222
p2p-peer-address =eos-p2p.worbli.io:33981
p2p-peer-address =18.188.38.175:9876
p2p-peer-address =18.221.255.38:9876
p2p-peer-address =eos.staked.us:9870
p2p-peer-address =peering.dutcheos.io:9876
p2p-peer-address =18.188.4.97:9876
p2p-peer-address =18.191.125.105:9876
p2p-peer-address =boot.eostitan.com:9876
p2p-peer-address =eosboot.chainrift.com:9876
p2p-peer-address =dc1.eosemerge.io:9876
p2p-peer-address =m.eosvibes.io:9876
p2p-peer-address =node1.eosphere.io:9876

2.添加插件

plugin = eosio::chain_plugin
plugin = eosio::chain_api_plugin
plugin = eosio::net_plugin
plugin = eosio::net_api_plugin
plugin = eosio::http_plugin

然后通过以下命令来启动节点

  1. cd ~/eos/build/program/nodeos

  2. ./nodeos --genesis-json genesis.json

你可能感兴趣的:(eos,区块链,eos)