Surou 发布的文章

配置自己的节点与EOS主网数据同步


本篇文章将讲解如何将自己机器部署的节点链接到EOS主网,并同步区块数据。

1.源码编译
2.修改config.ini
  • 修改producer-name为自己的节点名,例如producer-name = eos.dos
  • 修改private-key为自己的公钥私钥(在线生成
  • 添加p2p-peer-address 一些已知稳定访问的公网节点
    三种方式获取可用的p2p-peer-address:
  1. (科学上网访问)
  2. (EOSPark 进入BP节点,查看接入点)
  3. (已测试当前可用节点)
  4. (Block Producer bp.json Validator)
  5. (eosnation)
p2p-peer-address = node1.eosnewyork.io:6987
p2p-peer-address = p2p.eos42.io:9876
p2p-peer-address = peering.mainnet.eoscanada.com:9876
p2p-peer-address = node1.starteos.io:9876
  • 按自己需要添加一些插件支持
    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

~/.local/share/eosio/nodeos/config目录下执行 (目录可随意)

wget https://github.com/EOS-Mainnet/eos/raw/mainnet-1.0.5/mainnet-genesis.json

在上面目录下执行nodeos --genesis-json mainnet-genesis.json
出现错误Genesis state can only be set on a fresh blockchain
修改执行命令为

nodeos --genesis-json mainnet-genesis.json --delete-all-blocks

执行cleos get info查看chain_id

已经为EOS主网络。


EOS rpc list_keys Error 500


  • EOS版本:v1.0+
  • 问题:执行curl http://192.168.1.168:8888/v1/wallet/list_keys
    返回
    {"code":500,"message":"Internal Service Error","error":{"code":7,"name":"bad_cast_exception","what":"Bad Cast","details":[{"message":"Invalid cast from object_type to Array","file":"variant.cpp","line_number":535,"method":"get_array"}]}}
  • 错误分析:
    list_keys now requires an argument, which is your wallet password.
    修正请求
    curl --request POST --url http://192.168.1.112:8888/v1/wallet/list_keys --data '["default","PW5K2Rg4rSYanxx..."]'

    正确返回对应钱包内所有公钥私钥。


  • 常见问题(Wallet not found: default):
    EOS 1.0 release 之前如果创建钱包是用的默认创建命令
    cleos wallet create

    钱包位置是在/home/surou/eosio-wallet/./default.wallet
    可以用cleos wallet create再次创建 查看当前钱包文件位置。
    但是 wallet_api_plugin 查找的位置是在 /home/surou/.local/share/eosio/nodeos/data/./default.wallet(1.0 release左右之后 config.ini wallet-dir = ".")

  • 简单粗暴有效
    cp /home/surou/eosio-wallet/./default.wallet /home/surou/.local/share/eosio/nodeos/data/