Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intercept rescanblockchain #6

Draft
wants to merge 14 commits into
base: feature/bip155
Choose a base branch
from

Conversation

chrisguida
Copy link

@chrisguida chrisguida commented Mar 15, 2021

This feature intercepts calls to the rescanblockchain RPC call, using block filters to locate transactions that may have been pruned, enabling users to import wallets with birth dates older than the prune height and successfully track transactions from those wallets.

This feature fetches block filters using the getblockfilter RPC call, which will be available on pruned nodes starting with bitcoin core 0.22, which should be released in August. It then scans the block filters for a vector of addresses (output scripts), derived from a descriptor using the deriveaddresses RPC call, making note of relevant block hashes. (This scanning portion may be replaced with a call to the scanblocks RPC call once it gets merged/released.)

It then fetches the blocks using the list of relevant block hashes and scans through them, finding relevant transactions.

TODO:

  1. Use importprunedfunds RPC call to import the relevant transactions to core. This will require creating merkle proofs for each transaction's inclusion in its block.
  2. Handle edges, such as the utxo set, mempool, and unpruned blocks
  3. Actually intercept/handle the rescanblockchain call
  4. Optimize/parallelize for low-resource hardware. Currently it takes about 90 minutes to scan from genesis to tip for a set of 1000 addresses on an M1 Macbook Air.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants