[RPC] Getting the spent transaction outputs of transactions in latest blocks #19003

issue NicolasDorier opened this issue on May 18, 2020
  1. NicolasDorier commented at 6:54 AM on May 18, 2020: contributor

    I am trying to gather some stats based on a recently mined block, that I need to update continuously.

    One of the stat I am interested in is how many transaction are with round amount fees in the latest block.

    To do this, I would need to getblock then for each transaction input, get the previous one via getrawtransaction. Now two problems with this:

    1. This require an enormous amount of requests.
    2. This need txindex=1

    Would it be realistic instead, to just fetch the spent output data directly from the Block Undo data that is still stored in the disk? This data is guaranteed to be always around as we need it to handle reorg. It also contains all the information I would need for the whole block in one continuous storage area. (instead of querying around via txindex).

    Is there any other way I am missing?

    If I were to make a PR to add this feature, I think the easiest way would be to just expose the block undo data directly with a RPC method.

  2. NicolasDorier added the label Feature on May 18, 2020
  3. maflcko commented at 11:38 AM on May 18, 2020: member
  4. NicolasDorier commented at 4:13 PM on May 19, 2020: contributor

    That's exactly what I need. Will ping @FelixWeis

  5. robot-dreams commented at 11:54 PM on January 4, 2021: contributor

    @NicolasDorier does #18772 fix this? It was extracted from #16083 and adds fees to the getblock RPC.

    (Thanks @adamjonas for noticing this!)

  6. maflcko commented at 9:51 AM on January 5, 2021: member

    @robot-dreams The pull by @robot-visions only reports the total fee, not "how many transaction are with round amount fees in the latest block". This is being worked on in #18771 (comment)

  7. 0xB10C commented at 2:57 PM on February 26, 2021: contributor

    #21245 adds a prevout field to the transaction inputs in getblock <hash> 3.

  8. achow101 commented at 9:28 PM on October 26, 2022: member

    #22918 added getblock verbosity level 3 which adds prevout to each tx input.

  9. achow101 closed this on Oct 26, 2022

  10. bitcoin locked this on Oct 26, 2023

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: 2026-04-24 15:14 UTC

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