以太坊协议如何与 geth 协同工作

How Ethereum protocol works with geth

我是 Ethereum and generally to blockchain. I learned that Ethereum blockchain works on Kademlia. The distributed hash table and its working was beautiful and nicely explained by Eleuth P2P 的新手。

现在我使用了 geth to connect to the Ethereum Mainnet,它在 5 到 6 分钟内发现了 2 到 3 个最大对等点。

现在我知道算法了,但我担心的是如何发现第一个对等点?因为互联网只是一大组路由器和不同类型的计算机(服务器、计算机等),如果你像 ARP 那样广播发现。互联网将充斥着这些对等发现广播消息,这似乎不对。那么最初是如何建立连接的呢?此外,我们不能在首次连接时信任单个网络,因为这将使系统基于服务器和客户端而不是去中心化的,那么初始连接和对等点发现是如何发生的?

我猜广播消息是否像 TCP 那样具有 TTL 以防止循环?但这对我来说也是一个可怕的想法。

请说明。

In order to get going initially, geth uses a set of bootstrap nodes whose endpoints are recorded in the source code.

来源:Geth docs

这是 Geth 源代码中硬编码的 bootstrap 个节点的列表:https://github.com/ethereum/go-ethereum/blob/v1.10.11/params/bootnodes.go#L23

--bootnodes 选项允许您用自己的列表覆盖此列表。上述链接文档中的示例:

geth --bootnodes enode://pubkey1@ip1:port1,enode://pubkey2@ip2:port2,enode://pubkey3@ip3:port3