From 4046ac06396b48cd4fc93f4264368c90228a487d Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 16 Nov 2017 11:00:37 -0500 Subject: [PATCH] Guide - P2P IBD section - Updated .dot files - Minor adjustments for Dash --- _includes/devdoc/guide_p2p_network.md | 33 ++++++++++++--------------- _includes/references.md | 6 ++--- img/dev/en-ibd-block.dot | 3 ++- img/dev/en-ibd-block.svg | 2 +- img/dev/en-ibd-getblocks.dot | 6 +++-- img/dev/en-ibd-getblocks.svg | 4 ++-- img/dev/en-ibd-getblocks2.dot | 7 ++++-- img/dev/en-ibd-getblocks2.svg | 6 ++--- img/dev/en-ibd-getdata.dot | 6 ++--- img/dev/en-ibd-getdata.svg | 6 ++--- img/dev/en-ibd-inv.dot | 9 +++++--- img/dev/en-ibd-inv.svg | 6 ++--- 12 files changed, 50 insertions(+), 44 deletions(-) diff --git a/_includes/devdoc/guide_p2p_network.md b/_includes/devdoc/guide_p2p_network.md index 1aaec6ff..22110862 100644 --- a/_includes/devdoc/guide_p2p_network.md +++ b/_includes/devdoc/guide_p2p_network.md @@ -92,9 +92,7 @@ the status of payment. https://github.com/dashpay/dash/commit/2e7009d67b862cf822a1c70e181de6af659a3096 --> -To avoid this possible delay, BitcoinJ always uses dynamic DNS seeds to -get IP addresses for nodes believed to be currently active. -Dash Core also tries to strike a balance between minimizing delays +Dash Core tries to strike a balance between minimizing delays and avoiding unnecessary DNS seed use: if Dash Core has entries in its peer database, it spends up to 11 seconds attempting to connect to at least one of them before falling back to seeds; if a connection is @@ -106,7 +104,7 @@ and a function to use them, but I don't see that function being used in any of the examples/wallet templates (but I'm not Java fluent, so maybe PEBKAC). -@harding --> -Both Bitcoin Core and BitcoinJ also include a hardcoded list of IP +Dash Core also include a hardcoded list of IP addresses and port numbers to several dozen nodes which were active around the time that particular version of the software was first released. Dash Core will start attempting to connect to these nodes @@ -117,12 +115,11 @@ As a manual fallback option, Dash Core also provides several command-line connection options, including the ability to get a list of peers from a specific node by IP address, or to make a persistent connection to a specific node by IP address. See the `-help` text for -details. BitcoinJ can be programmed to do the same thing. +details. -**Resources:** [Bitcoin Seeder][], the program run by several of the -seeds used by Bitcoin Core and BitcoinJ. The Bitcoin Core [DNS Seed -Policy][]. The hardcoded list of IP addresses used by Bitcoin Core and -BitcoinJ is generated using the [makeseeds script][]. +**Resources:** [Dash Seeder][], the program run by several of the +seeds used by Dash Core. The Dash Core [DNS SeedPolicy][]. The hardcoded list + of IP addresses used by Dash Core is generated using the [makeseeds script][]. {% endautocrossref %} @@ -164,7 +161,7 @@ all the blocks which were produced since the last time it was online. Dash Core uses the IBD method any time the last block on its local best block chain has a block header time more than 24 hours in the past. -Bitcoin Core 0.10.0 will also perform IBD if its local best block chain is +Dash Core will also perform IBD if its local best block chain is more than 144 blocks lower than its local best header chain (that is, the local block chain is more than about 6 hours in the past). @@ -175,9 +172,9 @@ the local block chain is more than about 6 hours in the past). {% autocrossref %} -Bitcoin Core (up until version [0.9.3][bitcoin core 0.9.3]) uses a -simple initial block download (IBD) method we'll call *blocks-first*. -The goal is to download the blocks from the best block chain in sequence. +Dash Core (up until version 0.12.0.x) uses a simple initial block download (IBD) +method we'll call *blocks-first*. The goal is to download the blocks from the +best block chain in sequence. ![Overview Of Blocks-First Method](/img/dev/en-blocks-first-flowchart.svg) @@ -190,7 +187,7 @@ node chooses a remote peer, called the sync node, and sends it the In the header hashes field of the `getblocks` message, this new node sends the header hash of the only block it has, the genesis block -(6fe2...0000 in internal byte order). It also sets the stop hash field +(b67a...0000 in internal byte order). It also sets the stop hash field to all zeroes to request a maximum-size response. Upon receipt of the `getblocks` message, the sync node takes the first @@ -210,7 +207,7 @@ the block's header. The block inventories appear in the `inv` message in the same order they appear in the block chain, so this first `inv` message contains inventories for blocks 1 through 501. (For example, the hash of block 1 -is 4860...0000 as seen in the illustration above.) +is 4343...0000 as seen in the illustration above.) The IBD node uses the received inventories to request 128 blocks from the sync node in the `getdata` message illustrated below. @@ -277,7 +274,7 @@ of its downloading. This has several implications: * **Speed Limits:** All requests are made to the sync node, so if the sync node has limited upload bandwidth, the IBD node will have slow - download speeds. Note: if the sync node goes offline, Bitcoin Core + download speeds. Note: if the sync node goes offline, Dash Core will continue downloading from another node---but it will still only download from a single sync node at a time. @@ -285,7 +282,7 @@ of its downloading. This has several implications: otherwise valid) block chain to the IBD node. The IBD node won't be able to identify it as non-best until the initial block download nears completion, forcing the IBD node to restart its block chain download - over again from a different node. Bitcoin Core ships with several + over again from a different node. Dash Core ships with several block chain checkpoints at various block heights selected by developers to help an IBD node detect that it is being fed an alternative block chain history---allowing the IBD node to restart @@ -303,7 +300,7 @@ of its downloading. This has several implications: which may lead to high memory use. All of these problems are addressed in part or in full by the -headers-first IBD method used in Bitcoin Core 0.10.0. +headers-first IBD method used in Dash Core 0.12.0.x. **Resources:** The table below summarizes the messages mentioned throughout this subsection. The links in the message field will take you diff --git a/_includes/references.md b/_includes/references.md index a3c8b8f9..e87c6dea 100644 --- a/_includes/references.md +++ b/_includes/references.md @@ -437,9 +437,8 @@ http://opensource.org/licenses/MIT. [Bitcoin Core master]: https://github.com/dashpay/dash [Bitcoin Core pull #4468]: https://github.com/bitcoin/bitcoin/pull/4468 [Bitcoin core transifex]: https://www.transifex.com/projects/p/bitcoin/ -[Bitcoin reddit]: http://www.reddit.com/r/Bitcoin -[Bitcoin reddit new]: http://www.reddit.com/r/Bitcoin/new -[Bitcoin Seeder]: https://github.com/sipa/bitcoin-seeder +[Bitcoin reddit]: http://www.reddit.com/r/dashpay +[Bitcoin reddit new]: http://www.reddit.com/r/dashpay/new [Bitcoin stackexchange]: http://bitcoin.stackexchange.com [Bitcoin stackexchange tag bitcoin-qt]: http://bitcoin.stackexchange.com/questions/tagged/bitcoin-qt @@ -455,6 +454,7 @@ http://opensource.org/licenses/MIT. [core paymentrequest.proto]: https://github.com/dashpay/dash/blob/master/src/qt/paymentrequest.proto [core script.h]: https://github.com/dashpay/dash/blob/master/src/script/script.h [creative commons attribution 3.0 license]: https://creativecommons.org/licenses/by/3.0/ +[Dash Seeder]: https://github.com/nightlydash/dash-seeder/tree/master [DashJ]: https://github.com/HashEngineering/dashj [DER]: https://en.wikipedia.org/wiki/X.690#DER_encoding [dig command]: https://en.wikipedia.org/wiki/Dig_%28Unix_command%29 diff --git a/img/dev/en-ibd-block.dot b/img/dev/en-ibd-block.dot index 565811ba..1503cf47 100644 --- a/img/dev/en-ibd-block.dot +++ b/img/dev/en-ibd-block.dot @@ -28,7 +28,7 @@ block [ shape="plaintext", label=< - Start String
f9beb4d9 + Start String
bf0c6bbd Command
block Size
215 Checksum
934d270a @@ -38,6 +38,7 @@ block [ shape="plaintext", label=< Payload + // Serialized block value not changed to Dash block Serialized Block
010000006fe2...58eeac00000000 diff --git a/img/dev/en-ibd-block.svg b/img/dev/en-ibd-block.svg index 9a7277b8..078f0551 100644 --- a/img/dev/en-ibd-block.svg +++ b/img/dev/en-ibd-block.svg @@ -21,7 +21,7 @@ Message Header Start String -f9beb4d9 +bf0c6bbd Command block diff --git a/img/dev/en-ibd-getblocks.dot b/img/dev/en-ibd-getblocks.dot index 547a79c1..3589311c 100644 --- a/img/dev/en-ibd-getblocks.dot +++ b/img/dev/en-ibd-getblocks.dot @@ -17,6 +17,8 @@ ibd -> getblocks:f1 -> sync; ibd [ label = "IBD\nNode", shape="none" ]; sync [ label = "Sync\nNode", shape="none" ]; +// Genesis block hash - 00000ffd590b1485b3caadc19b22e6379c733355108f107a430458cdf3407ab6 + getblocks [ shape="plaintext", label=< @@ -28,7 +30,7 @@ getblocks [ shape="plaintext", label=< - + @@ -44,7 +46,7 @@ getblocks [ shape="plaintext", label=< - + diff --git a/img/dev/en-ibd-getblocks.svg b/img/dev/en-ibd-getblocks.svg index 7558d656..8b71e6ab 100644 --- a/img/dev/en-ibd-getblocks.svg +++ b/img/dev/en-ibd-getblocks.svg @@ -21,7 +21,7 @@ Message Header Start String -f9beb4d9 +bf0c6bbd Command getblocks @@ -40,7 +40,7 @@ 1 Header Hashes (Highest-Height First) -6fe28c0ab6f1b3...d6190000000000 +b67a40f3cd5804...140b59fd0f0000 Stopping Hash (Zero Is "No Stop") 00000000000000...00000000000000 diff --git a/img/dev/en-ibd-getblocks2.dot b/img/dev/en-ibd-getblocks2.dot index c329a6e8..06a745dc 100644 --- a/img/dev/en-ibd-getblocks2.dot +++ b/img/dev/en-ibd-getblocks2.dot @@ -17,6 +17,9 @@ ibd -> getblocks:f1 -> sync; ibd [ label = "IBD\nNode", shape="none" ]; sync [ label = "Sync\nNode", shape="none" ]; +// Block 500 hash - 000007248b1005ffdcf3f41f3a5630b5cb0078ca5733d931223839821f7f5faa +// Block 501 hash - 000003ad8ae16fd93d5ba05c902168b21a54855c98d1fcd5351308e0f05d59ab + getblocks [ shape="plaintext", label=<
Start String
f9beb4d9
Start String
bf0c6bbd
Command
getblocks
Size
69
Checksum
f5fcbcad
Header Hashes (Highest-Height First)
6fe28c0ab6f1b3...d6190000000000
Header Hashes (Highest-Height First)
b67a40f3cd5804...140b59fd0f0000
@@ -28,7 +31,7 @@ getblocks [ shape="plaintext", label=< - + @@ -44,7 +47,7 @@ getblocks [ shape="plaintext", label=< - + diff --git a/img/dev/en-ibd-getblocks2.svg b/img/dev/en-ibd-getblocks2.svg index 17ee971a..2fff0fff 100644 --- a/img/dev/en-ibd-getblocks2.svg +++ b/img/dev/en-ibd-getblocks2.svg @@ -21,7 +21,7 @@ Message Header Start String -f9beb4d9 +bf0c6bbd Command getblocks @@ -40,8 +40,8 @@ 20 Header Hashes (Highest-Height First) -db773c8f3b90ef...64f64f00000000 -459f16a1c695d0...f66d8000000000 +aa5f7f1f823938...05108b24070000 +ab595df0e00813...6fe18aad030000 ......18 more header hashes...... Stopping Hash (Zero Is "No Stop") diff --git a/img/dev/en-ibd-getdata.dot b/img/dev/en-ibd-getdata.dot index 62aa6ee3..da9ad7fd 100644 --- a/img/dev/en-ibd-getdata.dot +++ b/img/dev/en-ibd-getdata.dot @@ -28,7 +28,7 @@ getdata [ shape="plaintext", label=< - + @@ -54,11 +54,11 @@ getdata [ shape="plaintext", label=< - + - + diff --git a/img/dev/en-ibd-getdata.svg b/img/dev/en-ibd-getdata.svg index cd7f0226..ef6f77af 100644 --- a/img/dev/en-ibd-getdata.svg +++ b/img/dev/en-ibd-getdata.svg @@ -21,7 +21,7 @@ Message Header Start String -f9beb4d9 +bf0c6bbd Command getdata @@ -40,9 +40,9 @@ Type Unique Identifier (For Blocks, A Header Hash) Block -4860eb18bf1b1620...688e9a8300000000 +434341c0ecf9a2b4...d654121dd9070000 Block -bddd99ccfda39da1...065f626a00000000 +bddd99ccfda39da1...ce1e57ccaf0b0000 ...............126 more inventory entries............... diff --git a/img/dev/en-ibd-inv.dot b/img/dev/en-ibd-inv.dot index 534e5b8b..fdd57e13 100644 --- a/img/dev/en-ibd-inv.dot +++ b/img/dev/en-ibd-inv.dot @@ -17,6 +17,9 @@ ibd -> inv:f1 -> sync [ dir = "back" ]; ibd [ label = "IBD\nNode", shape="none" ]; sync [ label = "Sync\nNode", shape="none" ]; +// Block 1 - 000007d91d1254d60e2dd1ae580383070a4ddffa4c64c2eeb4a2f9ecc0414343 +// Block 2 - 00000bafcc571ece7c5c436f887547ef41b574e10ef7cc6937873a74ef1efeae + inv [ shape="plaintext", label=<
Start String
f9beb4d9
Start String
bf0c6bbd
Command
getblocks
Size
677
Checksum
52be83ef
Header Hashes (Highest-Height First)
db773c8f3b90ef...64f64f00000000
459f16a1c695d0...f66d8000000000

......18 more header hashes......
Header Hashes (Highest-Height First)
aa5f7f1f823938...05108b24070000
ab595df0e00813...6fe18aad030000

......18 more header hashes......
Start String
f9beb4d9
Start String
bf0c6bbd
Command
getdata
Size
4609
Checksum
33e41222
Block4860eb18bf1b1620...688e9a8300000000434341c0ecf9a2b4...d654121dd9070000
Blockbddd99ccfda39da1...065f626a00000000bddd99ccfda39da1...ce1e57ccaf0b0000
...............126 more inventory entries...............
@@ -28,7 +31,7 @@ inv [ shape="plaintext", label=< - + @@ -54,11 +57,11 @@ inv [ shape="plaintext", label=< - + - + diff --git a/img/dev/en-ibd-inv.svg b/img/dev/en-ibd-inv.svg index d52bf88c..9f83cd3f 100644 --- a/img/dev/en-ibd-inv.svg +++ b/img/dev/en-ibd-inv.svg @@ -21,7 +21,7 @@ Message Header Start String -f9beb4d9 +bf0c6bbd Command inv @@ -40,9 +40,9 @@ Type Unique Identifier (For Blocks, A Header Hash) block -4860eb18bf1b1620...688e9a8300000000 +434341c0ecf9a2b4...d654121dd9070000 block -bddd99ccfda39da1...065f626a00000000 +bddd99ccfda39da1...ce1e57ccaf0b0000 ...............498 more inventory entries...............
Start String
f9beb4d9
Start String
bf0c6bbd
Command
inv
Size
18003
Checksum
25173c57
block4860eb18bf1b1620...688e9a8300000000434341c0ecf9a2b4...d654121dd9070000
blockbddd99ccfda39da1...065f626a00000000bddd99ccfda39da1...ce1e57ccaf0b0000
...............498 more inventory entries...............