Terp Network Docs

P2P Networking

How Terp Network nodes communicate — CometBFT, peer discovery, gossip protocol, network topology

P2P Networking

Terp Network uses CometBFT (formerly Tendermint Core) for peer-to-peer networking. Nodes discover each other, gossip transactions and blocks, and maintain the network topology without central coordination.

CometBFT P2P Layer

Every Terp Network node runs a CometBFT P2P node that:

  • Discovers peers — via seed nodes, persistent peers, and peer exchange (PEX)
  • Gossips transactions — transactions broadcast across the network until included in a block
  • Propagates blocks — new blocks are rapidly distributed to all nodes
  • Maintains connections — nodes maintain a configurable number of outbound and inbound peers

Peer Discovery

Nodes find each other through:

  1. Seed nodes — well-known, stable nodes that provide initial peer lists
  2. Persistent peers — explicitly configured peers to always connect to
  3. PEX (Peer Exchange) — nodes share peer addresses they know about
# config.toml
[p2p]
seeds = "id@host:26656,id@host:26656"
persistent_peers = "id@host:26656"
pex = true

Peer Addressing

Peers are identified by their node ID (first 20 bytes of the node's Ed25519 public key, hex-encoded) and IP address:

<node-id>@<host>:<p2p-port>

The default P2P port is 26656.

Network Topology

Terp Network recommends a sentry node architecture for validators:

  • Validator node — private, only connects to sentry nodes
  • Sentry nodes — public, connect to the wider network, relay traffic to the validator
  • Full nodes — public, sync chain state, serve RPC queries
         Internet
     ┌─────┴─────┐
   Sentry 1   Sentry 2     ← public, DDoS-resistant
     └────┬─────┘
       Validator              ← private, only sentry peers

Sentry architecture diagram scaffold — a network diagram showing validator behind sentry nodes, with client connections to sentries and sentries connecting to the wider P2P network.

Transaction Gossip

When a transaction is broadcast to a node:

  1. Node validates the tx (signature, fee, nonce)
  2. Tx is added to the mempool
  3. Node gossips the tx to its peers
  4. Peers validate and relay further
  5. Eventually a validator includes the tx in a block

Block Propagation

When a validator produces a block:

  1. Block is proposed via consensus messages (Proposal, Prevote, Precommit)
  2. Validators gossip their votes
  3. Once +2/3 precommits received, the block is committed
  4. The block is gossiped to all nodes via the P2P layer

Block propagation sequence scaffold — a sequence diagram showing how a block moves from proposer validator through consensus rounds to all full nodes.

Key Configurations

ParameterDefaultDescription
max_peers50Maximum outbound + inbound peers
flush_throttle_timeout100msPeer send throttle
send_rate5120000Bytes/sec per connection
recv_rate5120000Bytes/sec per connection
max_tx_bytes1MBMaximum tx size in bytes

Further Reading

On this page