{"id":20756,"date":"2018-12-18T21:48:51","date_gmt":"2018-12-18T21:48:51","guid":{"rendered":"http:\/\/ci027cfe70c00c26c3"},"modified":"2018-12-18T21:48:51","modified_gmt":"2018-12-18T21:48:51","slug":"synching-data-between-bitcoin-nodes-about-get-easier","status":"publish","type":"post","link":"https:\/\/bitcoinmagazine.com\/technical\/synching-data-between-bitcoin-nodes-about-get-easier","title":{"rendered":"Syncing Data Between Bitcoin Nodes Is About to Get Easier"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div><figure><img decoding=\"async\" src=\"https:\/\/bitcoinmagazine.com\/wp-content\/uploads\/2024\/11\/syncing-data-between-bitcoin-nodes-is-about-to-get-easier.jpg\" title=\"\"><\/figure>\n<p><a href=\"https:\/\/github.com\/sipa\/minisketch\" target=\"_blank\" rel=\"noopener\">Minisketch<\/a> is a new solution that\u2019s trying to solve an old problem.<\/p>\n<p>Spearheaded by Blockstream co-founder Pieter Wuille, Bitcoin Core contributor and fellow Blockstream co-founder Gregory Maxwell, and Blockstream software engineer Gleb Naumenko, the open-source initiative is designed to achieve set reconciliation between the mempools of each full node. <\/p>\n<p>\u201cSet reconciliation, in short, is the problem of trying to figure out what the differences are between two sets stored on different computers, while minimizing how much data needs to be exchanged between them. In particular, it\u2019s trying to do so while sending less data than the entire set of data,\u201d Wuille told <em>Bitcoin Magazine<\/em><\/p>\n<p>For Bitcoin, this means discerning the differences in transaction data between nodes. Maxwell likened set reconciliation to the process of syncing your phone\u2019s contact list with another person who has many of the same contacts.<\/p>\n<p>\u201cYou could send them your whole list but it won\u2019t fit on a postcard and would be pretty wasteful in any case, since they already know most of the contacts \u2026 It is possible, in fact, to communicate your whole set of contacts to them by sending only as much information as the size of the difference between your lists even without any idea in advance of what the actual differences are,\u201d Maxwell told <em>Bitcoin Magazine<\/em>.<\/p>\n<p>In short, set reconciliation would reduce the bandwidth required to run a full node on the Bitcoin network by minimizing how much data each node transmits to each other. This would effectively allow nodes to sync up the data in their mempools more efficiently.<\/p>\n<h3>Breaking Down Set Reconciliation<\/h3>\n<p>The problem that minisketch wants to amend isn\u2019t blockchain specific.<\/p>\n<p>Set reconciliation is a constant frustration that any distributed system grapples with. Writ large, it simply means that two or more parties on a distributed network hold different sets of data, and to reconcile this, they must figure out which pieces of the data they\u2019re missing \u2014 as well as which pieces they have that the other party lacks.<\/p>\n<p>For Bitcoin, these data are transactions. These transactions are relayed from node to node until they are picked up by miners to be included into new blocks.<\/p>\n<p>The problem is that the order of transactions can vary from mempool to mempool (the queues that list incoming transactions to be included into new blocks). This means that there can be (and usually is) a discrepancy in the order of transactions between mempools and newly relayed blocks.<\/p>\n<p>\u201cBitcoin nodes have a \u2026 problem when relaying transactions between each other. Any given node will have mostly the same transactions as any one of its peers \u2014 received from other links, but not exactly the same. Today nodes waste a lot of bandwidth just figuring out who needs to be sent what [data],\u201d Maxwell said.<\/p>\n<h3>How Minisketch Closes the Gap<\/h3>\n<p>An implementation of the PinSketch algorithm, minisketch constructs a library of data to be used for constructing set sketches (i.e., for this use case, sets of transaction data). Nodes and miners can then use these sets for compact set reconciliation.<\/p>\n<p>Simply put, the solution would allow node operators to compare notes on transaction data. It would allow them to sketch (create) sets (lists) of transactions, and the program would cross-check these sets to see which data occurs in one but not both sets. Instead of spending time and energy revealing all of this data to each other, though, with minisketch, nodes only need to know the difference between their transaction sets to sketch a full set.<\/p>\n<p>As Wuille explained, it would look like this in practice:<\/p>\n<p>\u201cIf we simplify it to just a single difference, it\u2019s easy to see how this may work:<\/p>\n<ul>\n<li>Say I have the set {3,5,7,11}, and you have the set {3,5,7,9,11}, so the difference is {9}.<\/li>\n<li>We both compute the sum of our elements, so I obtain 3+5+7+11=26, and you obtain 3+5+7+9+11=35.<\/li>\n<li>I send my sum 26 to you, and you subtract it from your sum; the difference is 9.<\/li>\n<\/ul>\n<p>\u201cThis works, but it is restricted to finding a single difference. Minisketch generalizes this by sending various types of \u2018sums\u2019 of the data. The result is that with <em>N<\/em> different sums, you can find <em>N<\/em> differences \u2026 As long as the number of differences between the sets is not more than the number of \u2018sums\u2019 sent, minisketch will always succeed in finding all the differences.\u201d<\/p>\n<p>If successfully implemented, this set reconciliation could make transaction relay between nodes more efficient. Along with other in-the-works improvements to Bitcoin\u2019s infrastructure, this could reduce each node\u2019s broadcasting burden by a significant margin, Maxwell said.<\/p>\n<p>\u201cI made a measurement a while back and found that transaction relay <a href=\"https:\/\/bitcointalk.org\/index.php?topic=1377345.0\" target=\"_blank\" rel=\"noopener\">was about 87 percent<\/a> of a node\u2019s bandwidth usage. This was before compact blocks, so the number is potentially greater now. Our simulation results indicate that we might be able to cut relay overheads by the order of 40x through a combination of improvements that include minisketch.\u201d<\/p>\n<p>According to Wuille, the minisketch solution could also create \u201ca more robust network.\u201d Maxwell expanded on this line of thinking by indicating that with the protocol, nodes could use their saved bandwidth to connect with 16 to 24 other nodes instead of the standard 8, \u201cwhich would make some theoretical attacks even harder to pull off without using more bandwidth,\u201d he claimed.<\/p>\n<p>Maxwell is also hopeful that one day, minisketch could be used to revamp block propagation as well. \u201cThere have been other protocols for block propagation using IBLT (<a href=\"https:\/\/bitcoinmagazine.com\/articles\/how-the-magic-of-iblts-could-boost-bitcoin-s-decentralization-1448382673\">Invertible Bloom Lookup Table<\/a>) that minisketch would make a lot better,\u201d he said, though he admitted that such a solution is \u201cnot urgent\u201d because \u201c[compact] blocks already make block transfer itself use only about 4MB per node per day, so even if improvements reduced that number to nothing it wouldn\u2019t make that big of a difference to users or the network.\u201d Instead, he envisions this solution being more useful for \u201cvery low transmission like <a href=\"https:\/\/bitcoinmagazine.com\/articles\/blockstream-satellite-broadcasting-bitcoin-space\">Blockstream\u2019s satellite<\/a>.\u201d<\/p>\n<p>Wuille indicated that minisketch will reduce node bandwidth requirements and have a higher success probability than IBLT, but he conceded that for larger data sets, IBLT would be faster. Maxwell added that \u201cIBLT is very inefficient for less than a few hundred differences,\u201d while minisketch is more efficient for smaller data sets.<\/p>\n<p>Minisketch is still very much in the preliminary stages, however; Wuille stated that an actual BIP is a while away and that adoption is subject to a number of factors.<\/p>\n<p>Reiterating his observations to a point, Maxwell noted that the protocol is also not part of Bitcoin\u2019s network consensus. If any node operators felt comfortable enough and wanted to try to improve their transaction relays, they could choose to use minisketch even without its ubiquitous adoption on the network.<\/p>\n<p>\u201cOne useful point is that relay mechanisms are not a part of the Bitcoin consensus. You and I could start using an improved protocol between us regardless of what other people choose to do. This means that improvements to relay are only delayed by ordinary protocol\/software engineering considerations \u2014 we have to build it, verify it, integrate it, etc. \u2014 but unlike a consensus change, it doesn\u2019t depend on anyone agreeing to it except the people who choose to use it.\u201d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The minisketch open-source initiative is designed to achieve set reconciliation between the mempools of each full node.<\/p>\n","protected":false},"author":3468,"featured_media":20757,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[227,287,1922,3445,124,3313],"class_list":{"0":"post-20756","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-technical","8":"tag-bitcoin-core","9":"tag-blockstream","10":"tag-gleb-naumenko","11":"tag-greg-maxwell","12":"tag-nodes","13":"tag-pieter-wuille"},"author_data":{"id":3468,"name":"Aaron Van Wirdum And Colin Harper","nicename":"aaron-van-wirdum-and-colin-harper","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/88b6c65a7515990786b1c04473e15469e5b0d0fffef947ed629a60854e1cb426?s=96&d=robohash&r=g"},"featured_image_url":"https:\/\/bitcoinmagazine.com\/wp-content\/uploads\/2024\/11\/syncing-data-between-bitcoin-nodes-is-about-to-get-easier.jpg","_links":{"self":[{"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/posts\/20756","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/users\/3468"}],"replies":[{"embeddable":true,"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/comments?post=20756"}],"version-history":[{"count":0,"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/posts\/20756\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/media\/20757"}],"wp:attachment":[{"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/media?parent=20756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/categories?post=20756"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitcoinmagazine.com\/wp-json\/wp\/v2\/tags?post=20756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}