Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Bitcoin code analysis 4-node discovery mechanism

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

When the program first starts, it does not know the ip address of any active node. In order to find some full-node ip addresses, they will query one or more DNS domain names hard-coded in the bitcoin kernel or BitCoinJ, and the returned results should include one or more DNS A records with some full-node ip addresses that can accept new connections.

DNS seeds are maintained by members of the Bitcoin community. Some of them provide dynamic DNS seed servers, which automatically obtain the ip addresses of active nodes by scanning the bitcoin network; others provide some static DNS seeds, which need to be updated manually, but they most likely provide the ip addresses of inactive nodes. Whether dynamic or static DNS seed will be added to the DNS seed if the node runs on port number 8333 on the main network or port number 18333 on the test network.

DNS seed results are not authorized, and a malicious DNS seed operator or network middleman can return the ip address of nodes only controlled by them, isolate nodes in their own network, and give them fake transactions, block data. For this reason, programs should not rely on just one DNS seed.

However, nodes usually leave the network or change their ip address, so that when the program starts, it takes several attempts to connect to the bitcoin network. This increases the delay to connect to the Bitcoin network, forcing users to wait for a while before sending a transaction or checking the status of the payment.

To avoid this delay, BitcoinJ always uses dynamic DNS seeds to obtain the IP addresses of those nodes that are identified as active. The bitcoin kernel also tries to make tradeoffs between reducing latency and avoiding the use of unnecessary DNS nodes. If the Bitcoin kernel has a record in its node database, it will take 11 seconds to connect to at least one of the nodes. If it fails, it will use the DNS node to obtain the ip address. If the connection is successfully established within 11 seconds, it will no longer query the DNS seed.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report