1

建立具有相同 IP 地址的本地 Tendermint 网络时如何设置 config.toml 文件。我需要为每个节点设置“种子”和“持久节点”吗?

节点1

配置文件

proxy_app = "tcp://127.0.0.1:46658"
moniker = "pc-4e76-2"
fast_sync = false
db_backend = "leveldb"
db_path = "data"
log_level = "main:info,state:info,*:error"
genesis_file = "config/genesis.json"
priv_validator_file = "config/priv_validator.json"
node_key_file = "config/node_key.json"
abci = "socket"
prof_laddr = ""
filter_peers = false

[rpc]
laddr = "tcp://0.0.0.0:46657"
grpc_laddr = ""
unsafe = false

[p2p]
laddr = "tcp://0.0.0.0:46656"
seeds = ""
persistent_peers = "tcp://0.0.0.0:46659"
addr_book_file = "config/addrbook.json"
addr_book_strict = false
flush_throttle_timeout = 100
max_num_peers = 50
max_msg_packet_payload_size = 1024
send_rate = 512000
recv_rate = 512000
pex = true
seed_mode = false

[mempool]
recheck = true
recheck_empty = true
broadcast = true
wal_dir = "data/mempool.wal"

[consensus]
wal_file = "data/cs.wal/wal"
wal_light = false
timeout_propose = 3000
timeout_propose_delta = 500
timeout_prevote = 1000
timeout_prevote_delta = 500
timeout_precommit = 1000
timeout_precommit_delta = 500
timeout_commit = 1000
skip_timeout_commit = false
max_block_size_txs = 10000
max_block_size_bytes = 1
create_empty_blocks = false
create_empty_blocks_interval = 0
peer_gossip_sleep_duration = 100
peer_query_maj23_sleep_duration = 2000

[tx_index]
indexer = "kv"
index_tags = ""
index_all_tags = false

gensis.json

{
    "genesis_time": "0001-01-01T00:00:00Z",
    "chain_id": "test-chain-1uFNom",
    "validators": [
        {
            "pub_key": {
                "type": "ed25519",
                "data": "2920010B3C75FF9A33E6DF2BB483FE936CCD40A84B929FEABC86EA1B167FD613"
            },
            "power": 10,
            "name": ""
        },
        {
            "pub_key": {
                "type": "ed25519",
                "data": "1B6D7C4898007A7BB48E36FC11B8F5296A4FBF8B1280DD5A950F45A9064C8937"
            },
            "power": 10,
            "name": ""
        }

    ],
    "app_hash": ""
}

priv_validator.json

{
    "address": "C63DF7A33A2D72B908349CF99106B003BEEA8DF2",
    "pub_key": {
        "type": "ed25519",
        "data": 
"2920010B3C75FF9A33E6DF2BB483FE936CCD40A84B929FEABC86EA1B167FD613"
    },
    "last_height": 0,
    "last_round": 0,
    "last_step": 0,
    "last_signature": null,
    "priv_key": {
        "type": "ed25519",
        "data": "BA2044F3F67A24776048B938113F588C17DDCB292955DE9520BA60A0BB9FFA912920010B3C75FF9A33E6DF2BB483FE936CCD40A84B929FEABC86EA1B167FD613"
    }
}

节点2

配置文件

[rpc]
laddr = "tcp://0.0.0.0:46660"
[p2p]
laddr = "tcp://0.0.0.0:46659"
seeds = ""
persistent_peers = "tcp://0.0.0.0:46656"

(其他设置与node1相同)

gensis.json 与 node1 相同

priv_validator.json

{
    "address": "606FF21C48917E12EBC2266A3ED6168F8BE459A0",
    "pub_key": {
        "type": "ed25519",
        "data": "1B6D7C4898007A7BB48E36FC11B8F5296A4FBF8B1280DD5A950F45A9064C8937"
    },
    "last_height": 0,
    "last_round": 0,
    "last_step": 0,
    "last_signature": null,
    "priv_key": {
        "type": "ed25519",
        "data": "B05ACBB6DA6D9086827F057FEF6A03EA5F440853330B32540D6E3611F232106B1B6D7C4898007A7BB48E36FC11B8F5296A4FBF8B1280DD5A950F45A9064C8937"
    }
}

我尝试了很多方法。有时我可以让节点运行,但无法正确提交事务。

这些都是我在本地创建两个具有相同 IP 地址的验证器节点的设置。我得到了“重复对等”和“连接到自我”的错误。

Ensure peers                                 module=p2p numOutPeers=1 numDialing=0 numToDial=9
Will dial address                            module=p2p addr=0.0.0.0:46659
Will dial address                            module=p2p addr=e5b4313a3c7d690c673d6daf8bcbe5a69504274c@10.66.31.178:46656
We need more addresses. Sending pexRequest to random peer module=p2p peer="Peer{MConn{127.0.0.1:46659} 7fe6d6fd249279345bc57f114423d100c21151a5 out}"
Dialing peer                                 module=p2p address=0.0.0.0:46659
Dialing peer                                 module=p2p address=e5b4313a3c7d690c673d6daf8bcbe5a69504274c@10.66.31.178:46656
Failed to add peer                           module=p2p address=e5b4313a3c7d690c673d6daf8bcbe5a69504274c@10.66.31.178:46656 err="Connect to self"
Ignoring inbound connection: error while adding peer module=p2p address=10.66.31.178:51238 err="Connect to self"
Dialed peer with unknown ID - unable to authenticate module=p2p peer=0.0.0.0:46659 addr=0.0.0.0:46659
Failed to add peer                           module=p2p address=0.0.0.0:46659 err="Duplicate peer"
4

1 回答 1

0

我需要为每个节点设置“种子”和“持久节点”吗?

不,使用persistent_peers

使用未知 ID 拨打的对等方 - 无法进行身份验证

请在 IP:Port 对前面加上相应的节点 ID。https://tendermint.readthedocs.io/projects/tools/en/develop/using-tendermint.html#peers。您可以使用它tendermint show_node_id来获取节点 ID。或者更好的是,使用tendermint testnet命令创建本地测试网。

于 2018-04-12T09:41:08.890 回答