Describe new v2 format
[headersdns] / index.html
1 <!DOCTYPE html>
2 <html lang="en">
3         <head>
4                 <meta charset="utf-8">
5                 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
6                 <style type="text/css">
7                         body {
8                                 margin:40px auto;
9                                 max-width:660px;
10                                 line-height:1.6;
11                                 font-size:14pt;
12                                 color:#444;
13                                 padding:0 10px;
14                         }
15                         h1, h2, h3 {
16                                 line-height: 1.2;
17                         }
18                         pre {
19                                 overflow-x: scroll;
20                         }
21                         pre, .hex {
22                                 font-size: 9pt;
23                         }
24                         .hex {
25                                 font-family: monospace;
26                                 word-break: break-all;
27                         }
28                 </style>
29                 <title>Bitcoin Headers over DNS</title>
30         </head>
31         <body>
32                 <h2>
33                         Fetching Bitcoin Headers over DNS
34                 </h2>
35                 <p>
36                         If you're a Bitcoin user or application developer, uncensored access to the blockchain is absolutely critical, but can be very difficult to achieve. While Bitcoin Core has put significant effort into ensuring its tracking of known nodes in the P2P network is robust against sybil attackers, replicating that work would be a challenge for any small team. Worse still, in the opaque world of a global P2P network, how do you know if the effort you've put in is enough?
37                 </p>
38                 <p>
39                 More frightening, adding Lightning support to your wallet or system introduces new reliance on uncensorability of the P2P network, <a href="https://lists.linuxfoundation.org/pipermail/lightning-dev/2019-December/002369.html">with several new avenues for attack which even Bitcoin Core likely doesn't fully protect against.</a>
40                 </p>
41                 <p>
42                         bitcoinheaders.net exists to help provide one more, diverse, source of Bitcoin blockchain data - this time using the DNS. By fetching headers and/or neutrino filters from as many sources as possible, you can start to build reliable detection of censorship-based attacks. While this still leaves mitigation of the attacks to be developed, detection is always the first step.
43                 </p>
44                 <p>
45                         bitcoinheaders.net currently supports fetching of either full Bitcoin headers or neutrino filter headers, both with a similar format. To ensure reliable access in the face of strict DNS filters, the data is encoded in IPv6 addresses in AAAA records and DNSSec signed to prevent some basic attacks.
46                 </p>
47                 <p>
48                         Headers names are broken into sub-zones of 10,000 records, so queries should take the form of v2.height.(height / 10000).bitcoinheaders.net (or, for basic neutrino filter headers, v2.height.(height / 10000).basic.filter.bitcoinheaders.net).
49                 </p>
50                 <p>
51                         All headers and filter headers are encoded with an arbitrary one byte prefix (which you must ignore, as it may change in the future), followed by a 0-indexed order byte (as nameservers often reorder responses). Entries are then prefixed by a single version byte (currently version 1) and placed into the remaining bytes of the IPv6 addresses.
52                 </p>
53                 <p>
54                         The genesis block header is, thus, encoded as (note that the responses are usually not sorted):
55                 </p>
56                 <pre>
57 v2.0.0.bitcoinheaders.net. 604800 IN    AAAA    2603:7b12:b27a:c72c:3e67:768f:617f:c81b
58 v2.0.0.bitcoinheaders.net. 604800 IN    AAAA    2600:101::
59 v2.0.0.bitcoinheaders.net. 604800 IN    AAAA    2601::
60 v2.0.0.bitcoinheaders.net. 604800 IN    AAAA    2602::3b:a3ed:fd7a
61 v2.0.0.bitcoinheaders.net. 604800 IN    AAAA    2605:ab5f:49ff:ff00:1d1d:ac2b:7c00:0
62 v2.0.0.bitcoinheaders.net. 604800 IN    AAAA    2604:c388:8a51:323a:9fb8:aa4b:1e5e:4a29</pre>
63                 <p>which decodes to</p>
64                 <p class="hex">
65                         0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c
66                 </p>
67                 <p>and the 10,000th filter header encoded as:</p>
68                 <pre>
69 v2.10000.1.basic.filter.bitcoinheaders.net. 604800 IN AAAA 2601:2dee:3a70:76df:a4aa:5ee9:5285:5cdf
70 v2.10000.1.basic.filter.bitcoinheaders.net. 604800 IN AAAA 2600:165:e915:4fba:5588:31fa:473:8326
71 v2.10000.1.basic.filter.bitcoinheaders.net. 604800 IN AAAA 2602:25cf:4603:7300::</pre>
72                 <p>which decodes to</p>
73                 <p class="hex">
74                         65e9154fba558831fa047383262dee3a7076dfa4aa5ee952855cdf25cf460373
75                 </p>
76                 <p>
77                         You can find the <a href="https://git.bitcoin.ninja?p=headersdns">scripts used to generate the zones as well as this website via git.</a>
78                 </p>
79                 <p>
80                         If you want a full block source over a protocol other than Bitcoin-P2P, a anycast-cached Bitcoin Core REST interface endpoint is available at <a href="https://bitcoin-rest.bitcoin.ninja/">https://bitcoin-rest.bitcoin.ninja/</a> for mainnet and <a href="https://testnet.bitcoin-rest.bitcoin.ninja/">https://testnet.bitcoin-rest.bitcoin.ninja/</a> for testnet3. It should go without saying that this should only be used as a backup chain source, never as the primary chain source.
81                 </p>
82         </body>
83 </html>