bwt icon indicating copy to clipboard operation
bwt copied to clipboard

Provide partial history for pruned nodes using scantxoutset

Open shesek opened this issue 4 years ago • 4 comments

shesek avatar May 30 '20 02:05 shesek

Trying to figure this out manually, I wonder how is this supposed to work when no raw transaction information available (i.e. not only pruned node, but any node with no txindex enabled)? It's my understanding that raw transactions are needed for importprunedfunds to work. What am I missing?

leshik avatar Jun 06 '20 14:06 leshik

with scantxoutset (experimental) outputs of a descriptor can be found, and the height at which the funding transaction was confirmed is also known (but not the full transaction). since the headers are known, the height is enough information to re-fetch specific blocks to extract the raw tx and inclusion proof to be generated. this is kind of cumbersome and does not provide transactions that pertain to already spent outputs, but can at least be used to obtain previous transactions as will be required because of the recent changes to trezor's BIP 143 signing.

nothingmuch avatar Jun 06 '20 18:06 nothingmuch

Yeah, I understand that blocks with heights corresponding to funding transactions need to be re-fetched, just don't see how this could be done on a pruned node? There were some attempts to add this functionality to Bitcoin Core but none of them were merged.

leshik avatar Jun 07 '20 02:06 leshik

oops, i must have missed the email, sorry.

to get the full tx history - yeah it'd have to be something like those PRs, and I think it's unlikely.

but for spending currently unspent outputs, if you need the funding tx, you can still get the information needed to locate the txs precisely from the UTXO set using scantxoutset.

once you know the heights, fetching those blocks is pretty easy (and i don't i don't mean functionality in core, but writing a non-validating p2p client is pretty easy and libraries exist that let you do that), and your node already validated them in the past so it's just a matter of comparing them to the block header that the node doesn't prune.

nothingmuch avatar Jun 13 '20 18:06 nothingmuch