shuijian-xu / bitcoin

0 stars 0 forks source link

Bloom Filter #227

Open shuijian-xu opened 4 years ago

shuijian-xu commented 4 years ago

A Bloom filter can be optimized by,

  1. changing the number of hash functions and

  2. bit field size to get a desirable false-positive rate.

shuijian-xu commented 4 years ago

Bloom filter consists of:

  1. The size of the bit field

  2. The hash function used (and how we converted that to a number)

  3. The bit field, which indicates the bucket we’re interested in

shuijian-xu commented 4 years ago

A Bloom filter is a filter for all possible transactions. Full nodes run transactions through a Bloom filter and send merkleblock commands for transactions that make it through.

Suppose there are 50 total transactions. There is one transaction a light client is interested in. The light client wants to “hide” the transaction among a group of five transactions. This requires a function that groups the 50 transactions into 10 different buckets, and the full node can then send a single bucket of transactions, in a manner of speaking. This grouping would have to be deterministic—that is, be the same each time.