Bitcoin-Core
比特幣 dns 種子標誌
我正在開發一些比特幣的精簡客戶端,目前我正在嘗試通過節點支持的服務進行種子解析,這些服務通過 DNS 種子公開。
我在 bitcointalk 上找到了這篇文章,但我認為並非所有標誌功能都被記錄在案。特別是,我很想知道這是 BIP 158 服務的標誌功能,但我也想知道在哪裡可以看到比特幣核心上的所有這些標誌。看起來它們不再在程式碼中硬編碼,或者最好不再在程式碼中清晰硬編碼。
謝謝。
格式只是 xN.[seedname],其中 N 是所需的服務標誌,經過 OR 運算,以十六進制編碼。
來自比特幣核心
src/protocol.h
:NODE_NONE = 0, // NODE_NETWORK means that the node is capable of serving the complete block chain. It is currently // set by all Bitcoin Core non pruned nodes, and is unset by SPV clients or other light clients. NODE_NETWORK = (1 << 0), // NODE_BLOOM means the node is capable and willing to handle bloom-filtered connections. // Bitcoin Core nodes used to support this by default, without advertising this bit, // but no longer do as of protocol version 70011 (= NO_BLOOM_VERSION) NODE_BLOOM = (1 << 2), // NODE_WITNESS indicates that a node can be asked for blocks and transactions including // witness data. NODE_WITNESS = (1 << 3), // NODE_COMPACT_FILTERS means the node will service basic block filter requests. // See BIP157 and BIP158 for details on how this is implemented. NODE_COMPACT_FILTERS = (1 << 6), // NODE_NETWORK_LIMITED means the same as NODE_NETWORK with the limitation of only // serving the last 288 (2 day) blocks // See BIP159 for details on how this is implemented. NODE_NETWORK_LIMITED = (1 << 10),
所以作為一個假設的例子,假設你想要 NODE_WITNESS、NODE_COMPACT_FILTERS 和 NODE_NETWORK_LIMITED,你需要 N = (1 << 3) + (1 << 6) + (1 << 10) = 1096,它是
448
十六進制的。因此,您會查詢x448.[seedname]
.請注意,並非所有組合都受支持,哪些組合可能取決於種子。我的比特幣播種機軟體目前預設支持以下組合:
NODE_NETWORK NODE_NETWORK | NODE_BLOOM NODE_NETWORK | NODE_WITNESS NODE_NETWORK | NODE_WITNESS | NODE_COMPACT_FILTERS NODE_NETWORK | NODE_WITNESS | NODE_BLOOM NODE_NETWORK_LIMITED NODE_NETWORK_LIMITED | NODE_BLOOM NODE_NETWORK_LIMITED | NODE_WITNESS NODE_NETWORK_LIMITED | NODE_WITNESS | NODE_COMPACT_FILTERS NODE_NETWORK_LIMITED | NODE_WITNESS | NODE_BLOOM