Check that a Bitcoin node serves a compact block filter

A light-client backend needs both compact filter data and a filter header for a specific block. A healthy block RPC alone does not exercise that index.

Read a basic filter by block hash

Use a node with the basic block-filter index enabled and synced for the requested height. The example uses the current tip and converts the length of returned hex into a byte count.

hash=$(bitcoin-cli getbestblockhash)
bitcoin-cli getblockfilter "$hash" basic | jq '{filter_bytes: (.filter | length / 2), header}'

Preserve the association with the block

Store the sampled block hash with the filter header. The header commits to the filter chain and has a different meaning from a Bitcoin block header. If the block query works but the filter query fails, inspect the index status with getindexinfo. A successful filter fetch alone cannot confirm a wallet payment.

bitcoincore.org getblockfilter · bitcoincore.org getindexinfo