<p><a href="https://github.com/sipa/minisketch" rel="nofollow noreferrer">libminisketch</a> is a library implementing the <a href="https://www.cs.bu.edu/%7Ereyzin/code/fuzzy.html" rel="nofollow noreferrer">PinSketch</a> set reconciliation algorithm and was covered in this Bitcoin Core <a href="https://bitcoincore.reviews/minisketch-26" rel="nofollow noreferrer">PR review club</a>. In theory it could be used for any problem where you have two sets of data and want to work out how those data sets differ (which specific elements are present in one but missing in another) as efficiently as possible.</p>
<p>The primary use case for Minisketch at the time of writing (February 2021) is Erlay on Bitcoin.</p>
<p><a href="https://arxiv.org/pdf/1905.10518.pdf" rel="nofollow noreferrer">Erlay</a> is a proposal for more bandwidth efficient transaction relay in Bitcoin and was covered in this Bitcoin Core <a href="https://bitcoincore.reviews/18261" rel="nofollow noreferrer">PR review club</a>. The Minisketch library is used in Erlay for set reconciliation between peers (peers generally have slightly different sets of transactions in their individual mempools).</p>
<p>There is also potentially a Lightning use case for Minisketch which was described by Rusty Russell in this lightning-dev <a href="https://lists.linuxfoundation.org/pipermail/lightning-dev/2018-December/001741.html" rel="nofollow noreferrer">mailing list post</a>. Lightning nodes exchange gossip messages in an attempt to understand the topology of the network (nodes and channel sizes). They use this understanding to construct a route for a payment to a specific destination. This idea has not been implemented at the time of writing (February 2021). More centralized solutions such as <a href="https://medium.com/blockstream/keep-your-node-up-to-date-with-lnsync-e8d8ff7fadb8" rel="nofollow noreferrer">LN-sync</a> are currently used to address this problem.</p>
<p>There are also potential use cases unrelated to Bitcoin for Minisketch too. Pieter Wuille stated on IRC:</p>
<blockquote>
<p>One of the most deployed uses of efficient set reconciliation algorithms is in the way PGP keyservers synchronize (or at least used to); that's using cpisync (an earlier algorithm before pinsketch was invented, which has far worse performance)</p>
</blockquote>
<p>For additional possible applications of Minisketch see the Applications <a href="https://github.com/sipa/minisketch#applications" rel="nofollow noreferrer">section</a> of the README.</p>

CC BY-SA 4.0
2021-02-16T10:43:18.447Z
2021-04-21T13:45:56.910Z
2021-04-21T13:45:56.910Z
Michael Folkson
<p>What problem set is the <a href="https://github.com/sipa/minisketch" rel="nofollow noreferrer">Minisketch</a> library designed for? What is it currently used for and what could it be used for in future?</p>

<bitcoin-core-development><p2p>
What problem set is the Minisketch library designed for? What is it currently used for and what could it be used for in future?
Michael Folkson
# What problem set is the Minisketch library designed for? What is it currently used for and what could it be used for in future?

(Asked by: username_0 on 2021-02-13)

What problem set is the [Minisketch](https://github.com/sipa/minisketch) library designed for? What is it currently used for and what could it be used for in future?

**Tags:** bitcoin-core-development, p2p


---

## 1 answers

### Answer by username_0 on 2021-02-16. Score: 2 | Accepted answer

[libminisketch](https://github.com/sipa/minisketch) is a library implementing the [PinSketch](https://www.cs.bu.edu/%7Ereyzin/code/fuzzy.html) set reconciliation algorithm and was covered in this Bitcoin Core [PR review club](https://bitcoincore.reviews/minisketch-26). In theory it could be used for any problem where you have two sets of data and want to work out how those data sets differ (which specific elements are present in one but missing in another) as efficiently as possible.

The primary use case for Minisketch at the time of writing (February 2021) is Erlay on Bitcoin.

[Erlay](https://arxiv.org/pdf/1905.10518.pdf) is a proposal for more bandwidth efficient transaction relay in Bitcoin and was covered in this Bitcoin Core [PR review club](https://bitcoincore.reviews/18261). The Minisketch library is used in Erlay for set reconciliation between peers (peers generally have slightly different sets of transactions in their individual mempools).

There is also potentially a Lightning use case for Minisketch which was described by Rusty Russell in this lightning-dev [mailing list post](https://lists.linuxfoundation.org/pipermail/lightning-dev/2018-December/001741.html). Lightning nodes exchange gossip messages in an attempt to understand the topology of the network (nodes and channel sizes). They use this understanding to construct a route for a payment to a specific destination. This idea has not been implemented at the time of writing (February 2021). More centralized solutions such as [LN-sync](https://medium.com/blockstream/keep-your-node-up-to-date-with-lnsync-e8d8ff7fadb8) are currently used to address this problem.

There are also potential use cases unrelated to Bitcoin for Minisketch too. Pieter Wuille stated on IRC:

> One of the most deployed uses of efficient set reconciliation algorithms is in the way PGP keyservers synchronize (or at least used to); that's using cpisync (an earlier algorithm before pinsketch was invented, which has far worse performance)

For additional possible applications of Minisketch see the Applications [section](https://github.com/sipa/minisketch#applications) of the README.


---

