bitcoin/src
Wladimir J. van der Laan c775dc4a94
Merge #12254: BIP 158: Compact Block Filters for Light Clients
254c85b687 bench: Benchmark GCS filter creation and matching. (Jim Posen)
f33b717a85 blockfilter: Optimization on compilers with int128 support. (Jim Posen)
97b64d67da blockfilter: Unit test against BIP 158 test vectors. (Jim Posen)
a4afb9cadb blockfilter: Additional helper methods to compute hash and header. (Jim Posen)
cd09c7925b blockfilter: Serialization methods on BlockFilter. (Jim Posen)
c1855f6052 blockfilter: Construction of basic block filters. (Jim Posen)
53e7874e07 blockfilter: Simple test for GCSFilter construction and Match. (Jim Posen)
558c536e35 blockfilter: Implement GCSFilter Match methods. (Jim Posen)
cf70b55005 blockfilter: Implement GCSFilter constructors. (Jim Posen)
c454f0ac63 blockfilter: Declare GCSFilter class for BIP 158 impl. (Jim Posen)
9b622dc722 streams: Unit tests for BitStreamReader and BitStreamWriter. (Jim Posen)
fe943f99bf streams: Implement BitStreamReader/Writer classes. (Jim Posen)
87f2d9ee43 streams: Unit test for VectorReader class. (Jim Posen)
947133dec9 streams: Create VectorReader stream interface for vectors. (Jim Posen)

Pull request description:

  This implements the compact block filter construction in [BIP 158](https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki). The code is not used anywhere in the Bitcoin Core code base yet. The next step towards [BIP 157](https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki) support would be to create an indexing module similar to `TxIndex` that constructs the basic and extended filters for each validated block.

  ### Filter Sizes

  [Here](https://gateway.ipfs.io/ipfs/QmRqaAAQZ5ZX5eqxP7J2R1MzFrc2WDdKSWJEKtQzyawqog) is a CSV of filter sizes for blocks in the main chain.

  As you can see below, the ratio of filter size to block size drops after the first ~150,000 blocks:

  ![filter_sizes](https://user-images.githubusercontent.com/881253/42900589-299772d4-8a7e-11e8-886d-0d4f3f4fbe44.png)

  The reason for the relatively large filter sizes is that Golomb-coded sets only achieve good compression with a sufficient number of elements. Empirically, the average element size with 100 elements is 14% larger than with 10,000 elements.

  The ratio of filter size to block size is computed without witness data for basic filters. Here is a summary table of filter size ratios *for blocks after height 150,000*:

  | Stat | Filter Type |
  |-------|--------------|
  | Weighted Size Ratio Mean | 0.0198 |
  | Size Ratio Mean | 0.0224 |
  | Size Ratio Std Deviation | 0.0202 |
  | Mean Element Size (bits) | 21.145 |
  | Approx Theoretical Min Element Size (bits) | 21.025 |

Tree-SHA512: 2d045fbfc3fc45490ecb9b08d2f7e4dbbe7cd8c1c939f06bbdb8e8aacfe4c495cdb67c820e52520baebbf8a8305a0efd8e59d3fa8e367574a4b830509a39223f
2018-08-26 16:57:05 +02:00
..
bench Merge #12254: BIP 158: Compact Block Filters for Light Clients 2018-08-26 16:57:05 +02:00
compat Merge #13665: [build] Add risc-v support to gitian 2018-08-16 20:33:50 +02:00
config
consensus Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
crypto Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
index Break circular dependency: init -> * -> init by extracting shutdown.h 2018-06-25 00:08:49 -04:00
interfaces Add compile time checking for all cs_main runtime locking assertions 2018-08-26 00:25:28 +02:00
leveldb Merge leveldb subtree 2018-08-09 11:31:45 -04:00
obj
obj-test
policy Merge #13429: Return the script type from Solver 2018-08-25 17:41:00 +02:00
primitives Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
qt Merge #13961: util: Replace boost::signals2 with std::function 2018-08-25 21:13:46 +02:00
rpc Merge #12676: Show "bip125-replaceable" flag, when retrieving mempool entries 2018-08-26 00:04:05 +02:00
script Merge #13429: Return the script type from Solver 2018-08-25 17:41:00 +02:00
secp256k1 Bump secp256k1 subtree 2017-09-29 16:02:39 +02:00
support Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
test Merge #12254: BIP 158: Compact Block Filters for Light Clients 2018-08-26 16:57:05 +02:00
univalue univalue: Bump subtree 2018-02-10 09:55:54 -05:00
wallet Move cs_main locking annotations from .cpp to .h 2018-08-26 11:15:17 +02:00
zmq Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
.clang-format Fix inconsistent namespace formatting guidelines 2018-04-13 15:37:20 -04:00
addrdb.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
addrdb.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
addrman.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
addrman.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
amount.h
arith_uint256.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
arith_uint256.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
base58.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
base58.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
bech32.cpp Tighten up bech32::Decode(); add tests. 2018-04-12 17:52:33 -07:00
bech32.h Fix missing or inconsistent include guards 2018-03-22 16:23:04 +01:00
bitcoin-cli-res.rc
bitcoin-cli.cpp util: Replace boost::signals2 with std::function 2018-08-24 08:34:38 -04:00
bitcoin-tx-res.rc
bitcoin-tx.cpp util: Replace boost::signals2 with std::function 2018-08-24 08:34:38 -04:00
bitcoind-res.rc
bitcoind.cpp util: Replace boost::signals2 with std::function 2018-08-24 08:34:38 -04:00
blockencodings.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
blockencodings.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
blockfilter.cpp blockfilter: Optimization on compilers with int128 support. 2018-08-25 10:02:37 -07:00
blockfilter.h blockfilter: Additional helper methods to compute hash and header. 2018-08-25 10:02:37 -07:00
bloom.cpp Merge #13429: Return the script type from Solver 2018-08-25 17:41:00 +02:00
bloom.h Removes unsed CBloomFilter constructor. 2018-08-13 01:24:55 +02:00
chain.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
chain.h [trivial] Fix typo in CDiskBlockPos struct's ToString 2018-08-14 18:03:43 -05:00
chainparams.cpp Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
chainparams.h Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
chainparamsbase.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
chainparamsbase.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
chainparamsseeds.h net: Update hardcoded seeds 2018-08-13 13:57:15 +02:00
checkpoints.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
checkpoints.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
checkqueue.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
clientversion.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
clientversion.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
coins.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
coins.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
compat.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
compressor.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
compressor.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
core_io.h rpc: Expose ProcessNewBlockHeaders 2018-08-13 14:27:40 -04:00
core_memusage.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
core_read.cpp rpc: Expose ProcessNewBlockHeaders 2018-08-13 14:27:40 -04:00
core_write.cpp Merge #13429: Return the script type from Solver 2018-08-25 17:41:00 +02:00
cuckoocache.h Use explicit casting in cuckoocache's compute_hashes(...) to clarify integer conversion 2018-03-27 00:37:20 +02:00
dbwrapper.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
dbwrapper.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
fs.cpp scripted-diff: Replace #include "" with #include <> (ryanofsky) 2017-11-16 08:23:01 +13:00
fs.h
hash.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
hash.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
httprpc.cpp Merge #13534: Don't assert(foo()) where foo() has side effects 2018-08-13 10:02:50 -04:00
httprpc.h Cleanup StartRest() 2018-08-11 09:34:47 +03:00
httpserver.cpp http: Add const modifier to HTTPRequest methods 2018-08-20 01:35:55 +01:00
httpserver.h http: Add const modifier to HTTPRequest methods 2018-08-20 01:35:55 +01:00
indirectmap.h
init.cpp Merge #13634: ui: Compile boost::signals2 only once 2018-08-13 15:02:38 -04:00
init.h Break circular dependency: init -> * -> init by extracting shutdown.h 2018-06-25 00:08:49 -04:00
key.cpp Merge #13666: Always create signatures with Low R values 2018-08-13 12:07:20 +02:00
key.h Merge #13666: Always create signatures with Low R values 2018-08-13 12:07:20 +02:00
key_io.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
key_io.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
keystore.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
keystore.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
limitedmap.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
logging.cpp refactor: use fs:: over boost::filesystem:: 2018-08-15 21:05:21 +08:00
logging.h logging: remove unused return value from LogPrintStr 2018-05-02 11:25:20 +02:00
Makefile.am blockfilter: Implement GCSFilter constructors. 2018-08-25 10:02:37 -07:00
Makefile.bench.include bench: Benchmark GCS filter creation and matching. 2018-08-25 10:02:37 -07:00
Makefile.leveldb.include
Makefile.qt.include scripted-diff: Remove trailing whitespaces 2018-07-24 20:46:23 +01:00
Makefile.qttest.include crypto: cleanup sha256 build 2018-06-06 17:36:53 -04:00
Makefile.test.include blockfilter: Unit test against BIP 158 test vectors. 2018-08-25 10:02:37 -07:00
memusage.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
merkleblock.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
merkleblock.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
miner.cpp Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
miner.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
net.cpp Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
net.h Merge #13907: Introduce a maximum size for locators. 2018-08-10 19:52:13 +02:00
net_processing.cpp Add compile time checking for all cs_main runtime locking assertions 2018-08-26 00:25:28 +02:00
net_processing.h Add compile time checking for all cs_main runtime locking assertions 2018-08-26 00:25:28 +02:00
netaddress.cpp Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
netaddress.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
netbase.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
netbase.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
netmessagemaker.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
noui.cpp util: Replace boost::signals2 with std::function 2018-08-24 08:34:38 -04:00
noui.h
outputtype.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
outputtype.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
pow.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
pow.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
prevector.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
protocol.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
protocol.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
pubkey.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
pubkey.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
random.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
random.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
rest.cpp Cleanup StartRest() 2018-08-11 09:34:47 +03:00
reverse_iterator.h scripted-diff: Remove trailing whitespaces 2018-07-24 20:46:23 +01:00
reverselock.h
scheduler.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
scheduler.h Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
serialize.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
shutdown.cpp Break circular dependency: init -> * -> init by extracting shutdown.h 2018-06-25 00:08:49 -04:00
shutdown.h Break circular dependency: init -> * -> init by extracting shutdown.h 2018-06-25 00:08:49 -04:00
span.h Add more methods to Span class 2018-07-27 11:52:18 -07:00
streams.h streams: Implement BitStreamReader/Writer classes. 2018-08-25 10:02:37 -07:00
sync.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
sync.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
threadinterrupt.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
threadinterrupt.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
threadsafety.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
timedata.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
timedata.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
tinyformat.h Fix typos 2018-03-21 08:34:44 +02:00
torcontrol.cpp Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
torcontrol.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
txdb.cpp Return void instead of bool for functions that cannot fail 2018-07-27 13:19:03 +02:00
txdb.h Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
txmempool.cpp Move cs_main locking annotations from .cpp to .h 2018-08-26 11:15:17 +02:00
txmempool.h Move cs_main locking annotations from .cpp to .h 2018-08-26 11:15:17 +02:00
ui_interface.cpp Merge #13634: ui: Compile boost::signals2 only once 2018-08-13 15:02:38 -04:00
ui_interface.h Make macro compatible with MSVC 2018-08-14 09:19:47 +00:00
uint256.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
uint256.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
undo.h blockfilter: Construction of basic block filters. 2018-08-25 10:02:37 -07:00
util.cpp util: Replace boost::signals2 with std::function 2018-08-24 08:34:38 -04:00
util.h util: Replace boost::signals2 with std::function 2018-08-24 08:34:38 -04:00
utilmemory.h Extract MakeUnique into utilmemory.h 2018-07-17 13:56:21 -04:00
utilmoneystr.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
utilmoneystr.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
utilstrencodings.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
utilstrencodings.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
utiltime.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
utiltime.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
validation.cpp Add compile time checking for all cs_main runtime locking assertions 2018-08-26 00:25:28 +02:00
validation.h Add compile time checking for all cs_main runtime locking assertions 2018-08-26 00:25:28 +02:00
validationinterface.cpp Add compile time checking for all cs_main runtime locking assertions 2018-08-26 00:25:28 +02:00
validationinterface.h Add compile time checking for all cs_main runtime locking assertions 2018-08-26 00:25:28 +02:00
version.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
versionbits.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
versionbits.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
walletinitinterface.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
warnings.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
warnings.h Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00