Feature request: pruned chain and getrawtransaction #10609

issue BlackFoxController openend this issue on June 16, 2017
  1. BlackFoxController commented at 5:04 am on June 16, 2017: none

    I’d very much appreciate the (RPC) command getrawtransaction to work on a pruned node. When I browse the rawmempool or the last X blocks, I’d love to be able to find out about what’s gone on in these blocks.

    I have not tried pruning my node to test getrawtransaction but I’ve read that the txindex (needed for getrawtransaction) is incompatible with getrawtransaction. Why?

    Logically speaking I’d think I could browse and decode the X blocks (and transactions) that I do have stored. And if the block or transaction is not in my local database, could it not tell me something like: “this block does either not exist or it is not in your pruned version of the database”

    Maybe there can be a prunedtxindex option or perhaps txindex can be made compatible with the pruned option.

    Please tell me if this is technically possible or if it is not (if say old blocks need to be queried to decode a raw transaction)

  2. RHavar commented at 11:36 pm on June 16, 2017: contributor

    getrawtransaction currently works with pruned nodes as long as the transaction has at least one unspent output. I believe this functionality is deprecated though.

    The point of pruning is to throw away transactions that are no longer needed, and the point of txindex is to be able to search for old transactions by their transaction id. I’m not entirely sure these concepts are very compatible.

    I guess it would be theoretically possible to have a txindex for all transactions that aren’t pruned, but this seems a little weird.

  3. BlackFoxController commented at 2:20 am on June 17, 2017: none

    I’m currently reindexing and will have a look at the getrawtransaction method on a few recent transactions and see what it gets me.

    I just want to be able to read recent (confirmed and unconfirmed) transactions without relying on a public blockchain API and without running a full node (150+GB is a big chain for me to store).

    Is there any way to do this currently? In very essence, I want to create say, a webwallet that relies on a pruned local node and doesn’t use it for a wallet.

  4. MarcoFalke commented at 7:59 pm on June 18, 2017: member
    Related: #3220
  5. BlackFoxController commented at 9:08 am on June 19, 2017: none

    With some testing I can confirm that any unspent recent tx (in my pruned database) are indeed visible, as mentioned in 3220. Any spent tx seems to be unreadable.

    Not sure about the rawmempool, but I assume it acts the same (spent unreadable, unspent readable).

    Ideally getrawtransaction would also show me spent transactions but either way this is good enough for my use case.

    But I do not think it’s intended behaviour though as the documents say txindex and getrawtransaction should be incompatible. (keep it though! 👍 )

  6. Sjors commented at 12:03 pm on December 28, 2017: member

    A pruned node currently has no way of knowing if a transaction hash doesn’t exist or did exist but got pruned.

    Maybe a pruned node can use some bloom-filter like data structure to hold on to the full set of pruned transaction ids? That way getrawtransaction can return a clear error message and state with confidence that a given transaction doesn’t exist (false positives don’t really matter in this scenario).

    Alternatively - easier - getrawtransaction would take a since argument, required for pruned nodes, and throw an error if since is lower than the prune depth.

    This suggestion is separate from the issue that -txindex=1 currently doesn’t work with pruned nodes.

  7. jonasschnelli commented at 7:05 am on January 4, 2018: contributor

    IMO getrawtransaction, in disabled txindex mode, should not brows the blocks your have store locally because that could consume a serious amount of resources (assume you have pruned to 100GB). For that, a call searchrawtransaction would be more appropriate.

    Current master (next 0.16 release) will allow to fetch a transaction with getrawtransaction from a specific block : #10275.

  8. MarcoFalke added the label Feature on Apr 28, 2020
  9. MarcoFalke commented at 12:40 pm on April 28, 2020: member

    Current master (next 0.16 release) will allow to fetch a transaction with getrawtransaction from a specific block : #10275.

    Ok, closing for now.

    Let me know if there are any remaining issues that need to be solved.

  10. MarcoFalke closed this on Apr 28, 2020

  11. MarcoFalke locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-23 21:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me