* **[p2p](https://github.com/tendermint/tendermint/blob/master/p2p):** P2P networking stack. Designed to be extensible.
* **[p2p](https://github.com/tendermint/tendermint/blob/master/p2p):** P2P networking stack. Designed to be extensible.
* **[merkle](https://github.com/tendermint/tendermint/blob/master/merkle):** Immutable Persistent Merkle-ized AVL+ Tree, used primarily for keeping track of mutable state like account balances.
* **[merkle](https://github.com/tendermint/tendermint/blob/master/merkle):** Immutable Persistent Merkle-ized AVL+ Tree, used primarily for keeping track of mutable state like account balances.
* **[blocks](https://github.com/tendermint/tendermint/blob/master/blocks):** The blockchain, storage of blocks, and all the associated structures.
* **[state](https://github.com/tendermint/tendermint/blob/master/state):** The application state, which is mutated by blocks in the blockchain.
* **[consensus](https://github.com/tendermint/tendermint/blob/master/consensus):** The core consensus algorithm logic.
* **[mempool](https://github.com/tendermint/tendermint/blob/master/mempool):** Handles the broadcasting of uncommitted transactions.
* **[crypto](https://github.com/tendermint/tendermint/blob/master/crypto):** Includes cgo bindings of ed25519.
* **[crypto](https://github.com/tendermint/tendermint/blob/master/crypto):** Includes cgo bindings of ed25519.
Each peer connection is multiplexed into channels.
Each peer connection is multiplexed into channels.
<hr/>
### PEX channel
The PEX channel is used to exchange peer addresses.
The p2p module comes with a channel implementation used for peer
discovery (called PEX, short for "peer exchange").
<table>
<table>
<tr>
<tr>
@ -24,90 +21,6 @@ The PEX channel is used to exchange peer addresses.
</table>
</table>
<hr/>
<hr/>
### Block channel
The block channel is used to propagate block or header information to new peers or peers catching up with the blockchain.
<table>
<tr>
<td><b>Channel</b></td>
<td>"block"</td>
</tr>
<tr>
<td><b>Messages</b></td>
<td>
<ul>
<li>RequestMsg</li>
<li>BlockMsg</li>
<li>HeaderMsg</li>
</ul>
</td>
</tr>
<tr>
<td><b>Notes</b></td>
<td>
Nodes should only advertise having a header or block at height 'h' if it also has all the headers or blocks less than 'h'. Thus for each peer we need only keep track of two integers -- one for the most recent header height 'h_h' and one for the most recent block height 'h_b', where 'h_b' <= 'h_h'.
</td>
</tr>
</table>
<hr/>
### Mempool channel
The mempool channel is used for broadcasting new transactions that haven't yet entered the blockchain. It uses a lossy bloom filter on either end, but with sufficient fanout and filter nonce updates every new block, all transactions will eventually reach every node.
<table>
<tr>
<td><b>Channel</b></td>
<td>"mempool"</td>
</tr>
<tr>
<td><b>Messages</b></td>
<td>
<ul>
<li>MempoolTxMsg</li>
</ul>
</td>
</tr>
<tr>
<td><b>Notes</b></td>
<td>
Instead of keeping a perfect inventory of what peers have, we use a lossy filter.<br/>
Bloom filter (n:10k, p:0.02 -> k:6, m:10KB)<br/>
Each peer's filter has a random nonce that scrambles the message hashes.<br/>
The filter & nonce refreshes every new block.<br/>
</td>
</tr>
</table>
<hr/>
### Consensus channel
The consensus channel broadcasts all information used in the rounds of the Tendermint consensus mechanism.
<table>
<tr>
<td><b>Channel</b></td>
<td>"consensus"</td>
</tr>
<tr>
<td><b>Messages</b></td>
<td>
<ul>
<li>ProposalMsg</li>
<li>VoteMsg</li>
<li>NewBlockMsg</li>
</ul>
</td>
</tr>
<tr>
<td><b>Notes</b></td>
<td>
How do optimize/balance propagation speed & bandwidth utilization?