I'm failing to run the getblockfilter example. What am I doing wrong?

$ bitcoin-cli help getblockfilter
getblockfilter "blockhash" ( "filtertype" )

Retrieve a BIP 157 content filter for a particular block.

1. blockhash     (string, required) The hash of the block
2. filtertype    (string, optional, default=basic) The type name of the filter

{                      (json object)
  "filter" : "hex",    (string) the hex-encoded filter data
  "header" : "hex"     (string) the hex-encoded filter header

> bitcoin-cli getblockfilter "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09" "basic"
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblockfilter", "params": ["00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09", "basic"]}' -H 'content-type: text/plain;'

$ bitcoin-cli getblockfilter "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09" "basic"
error code: -1
error message:
Index is not enabled for filtertype basic

$ bitcoind --version
Bitcoin Core version v0.20.0.0-ga62f0ed64f8bbbdfe6467ac5ce92ef5b5222d1bd

Do I need to build a block filter index or something?

1 Answer 1


To enable the compact block filter, you need to start bitcoind with the -blockfilterindex=basic (or simply -blockfilterindex) command line option, or put that option in your bitcoin.conf file.

Depending on your hardware, it may take a few hours to build the compact block filter index. This is done in the background and does not affect normal node or wallet processing.

  • are there any other type of filters available? or is the only filtertype "basic"? Jul 7 at 0:27
  • 1
    @SachinMeier Currently there is only one filter type defined (in BIP158) and implemented in Bitcoin Core. There was originally planned to be an 'extended' filter type, but that was removed during development of the proposal here: github.com/bitcoin/bips/pull/687.
    – jnewbery
    Jul 8 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.