eosio连接主网的过程

一、看一下目前所处位置

cd eos/build/programs/cleos
./cleos get info

查看返回结果为:

{
"server_version": "40a20769",
"chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f",
"head_block_num": 935,
"last_irreversible_block_num": 934,
"last_irreversible_block_id": "000003a6120670564d3d1d2b077d0dfbd5242eb93cc179f86c224437276938f5",
"head_block_id": "000003a763938d8920f6214d53e3b042b6d0563f163d00501cac4eabb9f28294",
"head_block_time": "2018-08-06T02:06:59.500",
"head_block_producer": "eosio",
"virtual_block_cpu_limit": 508393,
"virtual_block_net_limit": 2668758,
"block_cpu_limit": 199900,
"block_net_limit": 1048576
}

我们看到chain_id为:
cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f
而实际的主网ID为:
aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906
很明显,我们现在在自己的测试网络里。

二、连接主网

连接主网的方法,是通过修改genesis.json里面的配置来实现。

首先,我们从其他文章中拷贝了一份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
}
}

首先,访问nodeos目录

cd ~/eos/build/programs/nodeos
vim genesis.json
将上面的文字复制进去,然后,ESC,:wq! , 回车,但这还没完成所有的配置。

接下来还要配置插件列表和节点地址

三、添加插件列表

cd ~/.local/share/eosio/nodeos/config
vim config.ini
将以下内容那个添加到文档末尾

plugin = eosio::chain_plugin
plugin = eosio::chain_api_plugin
plugin = eosio::net_plugin
plugin = eosio::net_api_plugin
plugin = eosio::history_plugin
plugin = eosio::history_api_plugin
plugin = eosio::http_plugin
plugin = eosio::http_client_plugin
plugin = eosio::wallet_api_plugin

然后,在后面继续添加节点地址:

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 = p2p.eosio.cr:1976
p2p-peer-address = p2p.eosio.cr:5418
p2p-peer-address = eno.eosvan.io:19866

到此,config.ini的配置基本完成。
保存后,我们尝试运行一下nodeos

cd ~/eos/build/programs/nodeos
./nodeos --genesis-json genesis.json

配置参数意思是,调用当前目录(~/eos/build/programs/nodeos)下的genesis.json

这个时候,应该会看到类似这样的界面:

eosio连接主网的过程_第1张图片
WX20180806-220304.png

这是在不断的同步区块。

可以到这里查看节点列表:
https://docs.google.com/spreadsheets/d/1K_un5Vak3eDh_b4Wdh43sOersuhs0A76HMCfeQplDOY/edit#gid=0

另外,可以到这里查看最新的区块信息:
https://eosmonitor.io/

好了,主网连接就算完成了。

有些坑,还是自己踩了才知道。

你可能感兴趣的:(eosio连接主网的过程)