You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
3.5 KiB

  1. # Peer Discovery
  2. A Tendermint P2P network has different kinds of nodes with different requirements for connectivity to one another.
  3. This document describes what kind of nodes Tendermint should enable and how they should work.
  4. ## Seeds
  5. Seeds are the first point of contact for a new node.
  6. They return a list of known active peers and then disconnect.
  7. Seeds should operate full nodes with the PEX reactor in a "crawler" mode
  8. that continuously explores to validate the availability of peers.
  9. Seeds should only respond with some top percentile of the best peers it knows about.
  10. See [the peer-exchange docs](https://github.com/tendermint/spec/blob/master/spec/reactors/pex/pex.md) for
  11. details on peer quality.
  12. ## New Full Node
  13. A new node needs a few things to connect to the network:
  14. - a list of seeds, which can be provided to Tendermint via config file or flags,
  15. or hardcoded into the software by in-process apps
  16. - a `ChainID`, also called `Network` at the p2p layer
  17. - a recent block height, H, and hash, HASH for the blockchain.
  18. The values `H` and `HASH` must be received and corroborated by means external to Tendermint, and specific to the user - ie. via the user's trusted social consensus.
  19. This requirement to validate `H` and `HASH` out-of-band and via social consensus
  20. is the essential difference in security models between Proof-of-Work and Proof-of-Stake blockchains.
  21. With the above, the node then queries some seeds for peers for its chain,
  22. dials those peers, and runs the Tendermint protocols with those it successfully connects to.
  23. When the peer catches up to height H, it ensures the block hash matches HASH.
  24. If not, Tendermint will exit, and the user must try again - either they are connected
  25. to bad peers or their social consensus is invalid.
  26. ## Restarted Full Node
  27. A node checks its address book on startup and attempts to connect to peers from there.
  28. If it can't connect to any peers after some time, it falls back to the seeds to find more.
  29. Restarted full nodes can run the `blockchain` or `consensus` reactor protocols to sync up
  30. to the latest state of the blockchain from wherever they were last.
  31. In a Proof-of-Stake context, if they are sufficiently far behind (greater than the length
  32. of the unbonding period), they will need to validate a recent `H` and `HASH` out-of-band again
  33. so they know they have synced the correct chain.
  34. ## Validator Node
  35. A validator node is a node that interfaces with a validator signing key.
  36. These nodes require the highest security, and should not accept incoming connections.
  37. They should maintain outgoing connections to a controlled set of "Sentry Nodes" that serve
  38. as their proxy shield to the rest of the network.
  39. Validators that know and trust each other can accept incoming connections from one another and maintain direct private connectivity via VPN.
  40. ## Sentry Node
  41. Sentry nodes are guardians of a validator node and provide it access to the rest of the network.
  42. They should be well connected to other full nodes on the network.
  43. Sentry nodes may be dynamic, but should maintain persistent connections to some evolving random subset of each other.
  44. They should always expect to have direct incoming connections from the validator node and its backup(s).
  45. They do not report the validator node's address in the PEX and
  46. they may be more strict about the quality of peers they keep.
  47. Sentry nodes belonging to validators that trust each other may wish to maintain persistent connections via VPN with one another, but only report each other sparingly in the PEX.