How to set the config.toml file when establish a local Tendermint network with the same ip address. Do I need to set both 'seeds' and 'persistent_peers' for each node?
node1
congfig.toml
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"
}
}
node2
config.toml
[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"
(other settings are same with node1)
gensis.json same with 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"
}
}
I tried many ways. Sometimes I can get nodes run, but transactions cannot be correctly committed.
These are all my settings for creating two validator nodes locally with the same ip address. I got the errors of "duplicate peer" and "Connect to self".
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"
Do I need to set both 'seeds' and 'persistent_peers' for each node?
no, use persistent_peers
Dialed peer with unknown ID - unable to authenticate
please prepend IP:Port pairs with respective node IDs. https://tendermint.readthedocs.io/projects/tools/en/develop/using-tendermint.html#peers. You can use tendermint show_node_id
to get node id. Or better, use tendermint testnet
command to create a local testnet.
来源:https://stackoverflow.com/questions/49776159/how-to-create-a-tendermint-local-network-with-same-ip