Collect the header proof for a Decred version-two compact filter

A light client using an untrusted filter server needs a way to check that the filter bytes are committed to by the block. The version-two RPC includes the authentication path alongside the serialized filter.

Collect all proof components

Set BLOCK to a block covered by header commitments on the intended chain. Check that blockhash matches the requested hash. Preserve the serialized filter bytes, proofindex and ordered proofhashes as one fixture.

dcrctl getcfilterv2 "$BLOCK" | jq '{blockhash, proofindex, proofhashes, data}'

Verify against an independent header

Hash the filter with the protocol's filter-hash procedure and use the leaf index and sibling hashes in a Decred-compatible commitment-proof verifier. Anchor the verification to a header already validated by the client. A server returning both a root and a matching path for an untrusted header cannot independently establish chain membership.

github.com getcfilterv2