下载编译安装EOS
# 我们以EOS-Mainnet仓库部署,(EOS-Mainnet是部署在目前EOS主网的版本,等于再次在EOSIO仓库测试过的版本,更稳定。)
git clone https://github.com/EOS-Mainnet/eos.git
# 切换分支, 目前稳定版本为mainnet-1.6.0
git checkout mainnet-1.6.0
# build
./eosio_build.sh
# install
sudo ./eosio_install.sh
# 完成之后查看版本
nodeos -v
mainnet-1.6.0
编辑配置文件
# linux下
vi ~/.local/share/eosio/nodeos/config/config.ini
# macos下
~/Library/Application\ Support/eosio/nodeos/data/
# 添加p2p-pper-address, 可以从下面的链接获得
https://eosnodes.privex.io/?config=1
# 点击上面链接获取到下面的数据, 粘贴到config.ini里
p2p-peer-address = 185.253.188.1:19876
p2p-peer-address = 807534da.eosnodeone.io:19872
p2p-peer-address = api-full1.eoseoul.io:9876
p2p-peer-address = api-full2.eoseoul.io:9876
p2p-peer-address = api.eosuk.io:12000
p2p-peer-address = boot.eostitan.com:9876
p2p-peer-address = bp.antpool.com:443
p2p-peer-address = bp.cryptolions.io:9876
p2p-peer-address = bp.eosbeijing.one:8080
p2p-peer-address = bp.libertyblock.io:9800
p2p-peer-address = br.eosrio.io:9876
p2p-peer-address = eos-seed-de.privex.io:9876
p2p-peer-address = eos.nodepacific.com:9876
p2p-peer-address = eos.staked.us:9870
p2p-peer-address = eu-west-nl.eosamsterdam.net:9876
p2p-peer-address = eu1.eosdac.io:49876
p2p-peer-address = fn001.eossv.org:443
p2p-peer-address = fullnode.eoslaomao.com:443
p2p-peer-address = mainnet.eosarabia.org:3571
p2p-peer-address = mainnet.eoscalgary.io:5222
p2p-peer-address = mainnet.eospay.host:19876
p2p-peer-address = mars.fnp2p.eosbixin.com:443
p2p-peer-address = node.eosflare.io:1883
p2p-peer-address = node1.eosnewyork.io:6987
p2p-peer-address = node2.eosnewyork.io:6987
p2p-peer-address = p.jeda.one:3322
p2p-peer-address = p2p.eosio.cr:1976
p2p-peer-address = p2p.genereos.io:9876
p2p-peer-address = p2p.meet.one:9876
p2p-peer-address = p2p.one.eosdublin.io:9876
p2p-peer-address = p2p.two.eosdublin.io:9876
p2p-peer-address = p2p.unlimitedeos.com:15555
p2p-peer-address = peer.eosjrr.io:9876
p2p-peer-address = peer.eosn.io:9876
p2p-peer-address = peer.main.alohaeos.com:9876
p2p-peer-address = peer1.mainnet.helloeos.com.cn:80
p2p-peer-address = peer2.mainnet.helloeos.com.cn:80
p2p-peer-address = peering.mainnet.eoscanada.com:9876
p2p-peer-address = peering2.mainnet.eosasia.one:80
p2p-peer-address = pub0.eosys.io:6637
p2p-peer-address = pub1.eosys.io:6637
p2p-peer-address = publicnode.cypherglass.com:9876
p2p-peer-address = seed1.greymass.com:9876
p2p-peer-address = seed2.greymass.com:9876
# 这个默认是1024, 不够用的话启动nodeos就会报错bad alloc, 改到4096之后依然不够, 改到8192之后终于可以了
# Maximum size (in MiB) of the chain state database (eosio::chain_plugin)
chain-state-db-size-mb = 8192
# 这个原来是127.0.0.1:8888, 不确定不改能不能行
http-server-address = 0.0.0.0:8888
# 这个原来是1, 也不确定不改能不能行
http-validate-host = false
# 需要的插件
plugin = eosio::chain_api_plugin
plugin = eosio::history_api_plugin
plugin = eosio::chain_plugin
plugin = eosio::history_plugin
plugin = eosio::net_plugin
plugin = eosio::net_api_plugin
plugin = eosio::http_plugin
编辑genesis.json
# 默认的genesis.json在 eos/build目录下, 相比默认的, 修改时间戳和key就好了
# 可以直接下载
wget https://eosnodes.privex.io/static/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
}
}
第一次启动
# 因为在config.ini里配置了plugin, 所以就不需要再指定plugin了
# 据说第一次启动需要指定genesis.json, 进到genesis.json所在目录执行以下命令
nodeos --genesis-json genesis.json
# 如果失败了可以删除以前的旧数据
rm -rf ~/.local/share/eosio/nodeos/data/blocks/*
rm -rf ~/.local/share/eosio/nodeos/data/state/*
查看是否是连到主网
# 查看chain id是否是aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906
cleos get info
# 查看第191块block(也不知道为什么教程里都是这个, 估计是因为191块里转账memo的一段话)
cleos get block 191
“data”: {
“from”: “eosio”,
“to”: “b1”,
“quantity”: “10.0000 EOS”,
“memo”: “Never doubt that a small group of thoughtful, committed citizens can change the world; indeed, it’s the only thing that ever has - eosacknowledgments.io”
从snapshots启动
# 进到data目录
cd ~/.local/share/eosio/nodeos/data
# 删除snapshots,state和blocks目录, 也就是把data目录下清空了
# 下载快照
wget $(wget --quiet "https://eosnode.tools/api/snapshots?limit=1" -O- | jq -r '.data[0].s3') -O snapshot.tar.gz
# 解压
tar xvzf snapshot.tar.gz
# 启动 (后面的名字需要换成当时下载的文件名)
nodeos --snapshot snapshots/snapshot-0260cc527fa835e8d9dcb44793e2bf58aa6ca6e67638de034042e29cff1ae40a.bin
退出nodeos再启动
# 查到进程
ps -ef | grep nodeos
ubuntu 12745 1 27 02:43 ? 01:21:48 nodeos
ubuntu 13324 13277 0 07:41 pts/1 00:00:00 grep --color=auto nodeos
# 保存并退出 (注意是-2, 之前用-9强制退出之后就启动不了了)
kill -2 12745
# 再启动, 直接nodeos命令就可以了
nodeos
参考链接
从EOS 主网同步数据
eos 同步主网节点-石墨
新手教程 从 EOS 主网同步数据
EOS snapshots快照