Ethereum Nodes – How Do Nodes Sync With Each Other?

clientsprotocol

Ethereum network is essentially a distributed replicated database where each node is a replica and a "master" one.

What happens when user submits a new transaction? It is submitted to some "pending transactions pool" which is synced with other nodes (since it's possible to see pending transaction on etherscan). Which protocol is used to sync this information?

Then transaction is included into a block and mined and it becomes a part of a blockchain and it's imported by a client. Which protocol is used by nodes to exchange most recent blocks?

Best Answer

Currently, when a user submits a transaction that transaction is then sent to all their peers, which in turn send it to all their peers, etc. Within seconds every active full node in the Ethereum network should have the transaction hash at the very least. Miners receive this transaction, check for validity and other things (like orphaned transactions), then bundle it together with a bunch of other transactions they received into a block.

The protocol used to exchange most recent blocks is https://github.com/ethereum/wiki/wiki/%C3%90%CE%9EVp2p-Wire-Protocol. The protocol uses RLPx, explanation is https://github.com/ethereum/devp2p/blob/master/rlpx.md, and it is based on RLP, the serialization protocol for Ethereum. https://github.com/ethereum/wiki/wiki/RLP

EDIT: These protocols are used for sending any data between Ethereum nodes.