EOS笔记2--同步主网与测试网

EOS笔记2--同步主网与测试网

  • 配置数据存放路径
  • 配置创世节点
  • 创建配置文件
  • 修改配置文件
    • 修改配置文件增加plugin
    • 修改配置文件增加节点地址
  • 首次启动节点
  • 测试
  • 那么测试网如何同步呢?
  • 参考资料

配置数据存放路径

这里需要存放数据以及配置文件

mkdir ~/eosdata
cd eosdata

配置~下的eosdata为数据存放路径

配置创世节点

在数据路径中新建一个
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 -d ~/eosdata/generator_node --config-dir ~/eosdata/generator_node  --plugin eosio::chain_api_plugin --p2p-listen-endpoint localhost:5555

这条命令运行几秒,就可以在eosdata/generator_node的路径下生成一个config.ini的文件

修改配置文件

修改配置文件增加plugin

也就是在config.ini中添加如下内容

plugin = eosio::producer_plugin
plugin = eosio::chain_api_plugin
plugin = eosio::http_plugin
plugin = eosio::history_api_plugin

修改配置文件增加节点地址

我的节点地址是从这里找的
https://docs.google.com/spreadsheets/d/1K_un5Vak3eDh_b4Wdh43sOersuhs0A76HMCfeQplDOY/edit#gid=0
该网址需要用科学的姿势打开。。。。
在config.ini中添加如下内容

eu-west-nl.eosamsterdam.net:9876
p2p.mainnet.eosgermany.online:9876
54.38.250.15:19878
p2p.genereos.io:9876
mainnet.eospay.host:19876
130.211.59.178:9876
54.153.59.31:9999
94.130.250.22:9806  
peer.main.alohaeos.com:9876
peer.eosn.io:9876
prod.mainnet.eos.cybex.io:9888
p2p-1.eosnetwork.io:9876
p.jeda.one:3322
eosbattles.com:9877
34.226.76.22:9876
mainnet.eosoasis.io:9876
node.eosflare.io:1883
mainnet.eoscalgary.io:5222
eos-p2p.worbli.io:33981
18.188.38.175:9876
18.221.255.38:9876
eos.staked.us:9870
peering.dutcheos.io:9876
18.188.4.97:9876
18.191.125.105:9876 
boot.eostitan.com:9876
eosboot.chainrift.com:9876
dc1.eosemerge.io:9876
m.eosvibes.io:9876
node1.eosphere.io:9876
node2.eosphere.io:9876
45.33.60.65:9820 
p2p.eosio.cr:1976
p2p.eosio.cr:5418
eno.eosvan.io:19866
eosnode.fi:9888
api.eosuk.io:12000 
fullnode.eoslaomao.com:443
new.eoshenzhen.io:10034
peer.eosio.sg:9876
eos.nodepacific.com:9876
bp.cryptolions.io:9876
18.234.6.119:80
eu1.eosdac.io:49876
br.eosrio.io:9876 
p2p-public.hkeos.com:19875
node.eosmeso.io:9876
pub1.eostheworld.io:9876
807534da.eosnodeone.io:19872
mainnet.eoseco.com:10010
p2p.mainnet.eospace.io:88
bp.libertyblock.io:9800
p2p.meet.one:9876
mars.fnp2p.eosbixin.com:443
peer1.eosthu.com:8080
peer2.eosthu.com:8080
node1.eosamericas.com:9876
bp.antpool.com:443
pub2.eostheworld.io:9876 
mainnet.eos.ren:9376
bp.superone.io:57576
mainnet-eos.wancloud.cloud:55576
dns1-p2p.oraclechain.io:49876
api-full1.eoseoul.io:9876
api-full2.eoseoul.io:9876
bp.eosbeijing.one:8080
testnode.eosgalaxy.io:9876
peer1.mainnet.eos.store:80 
peer2.mainnet.eos.store:80
pub0.eosys.io:6637
pub1.eosys.io:6637
onedapp.oneeos.org:9000
peer1.eospalliums.org:9876
peer2.eospalliums.org:9876
mainnet.eoswz.com:8866
mainnet.bepal.io:8866
34.252.209.121:5556   
node1.eosnewyork.io:6987
node2.eosnewyork.io:6987
mainnet1.eostaxrelief.com:9876
mainnet2.eostaxrelief.com:9876
112.119.195.79:9876
bp.blockchainlab.me:9090
publicnode.cypherglass.com:9876
node1.eoscannon.io:59876
eoswest.amberdata.io:9876
159.65.214.150:9876
eos-seed-de.privex.io:9876
mainnet.eosarabia.org:3571
node.eosio.lt:9878
fn001.eossv.org:443
peer.blockgenicbp.com:9876
node2.eosarmy.io:3330
bp.eos.miami:13975
fullnode.acroeos.one:9876
node1.liquideos.com
node2.liquideos.com
195.43.95.98:9876
peer1.mainnet.helloeos.com.cn:80
peer2.mainnet.helloeos.com.cn:80
node1.blockeos.io:9987
node2.blockeos.io:9987
p2p.eosdetroit.io:3018
p2p.eos.blckchnd.com:9876
eosapi.blockmatrix.network:13546
p2p.one.eosdublin.io:9876
p2p.two.eosdublin.io:9876
185.253.188.1:19876
185.253.188.1:19877
159.89.124.54:9876 
p2p.eosholding.ca:9876
p2p.unlimitedeos.com:15555
peering.mainnet.eoscanada.com:9876
18.191.33.148:59876
peer1.eos.csx.io:9806
peer2.eos.csx.io:9806
seed1.greymass.com:9876
seed2.greymass.com:9876
eos.infinitystones.io:9876
node.eos.lawyer:9876
p2p.eos.bitspace.no:9876
node1.eosjapan.co.jp:9876
eosnode.motion.one:443
eosbp.buildteam.io:8532
178.49.174.48:9876 
106.10.42.238:9876
47.75.70.54:9876
node869-mainnet.eosauthority.com:9393

##修改配置文件中内存使用限制
这里如果不修改,主网在同步到200多万高度的时候就会停止
将config.ini中的
chain-state-db-size-mb修改为4096
chain-state-db-guard-size-mb修改为2048

首次启动节点

nodeos -d ~/eosdata/generator_node --config-dir ~/eosdata/generator_node --genesis-json /root/eosdata/genesis.json --delete-all-blocks

后面再启动的时候,就不需要–genesis-json /root/eosdata/genesis.json --delete-all-blocks这两个参数了

测试

运行

cleos get info

就可以看到我们的同步信息了

那么测试网如何同步呢?

所有的步骤都相同只不过创世节点和peer的地址需要修改,eos官方提供的测试网路有两个

https://developers.eos.io/eosio-nodeos/docs/testnets
在其中的打开网站就可以找到github中有提供genesis.json替换即可,peer的地址也可以在网站中找到

参考资料

https://blog.csdn.net/lizhe_dashuju/article/details/80746377

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