Skip to content

wallet: decode raw transaction in gettransaction #16181

Closed

Description

@maflcko

Does it make sense to decode the raw transaction in the wallet-rpc gettransaction call (or add an optional parameter to do so)?

See discussion in #15159 (comment)

Activity

  1. nikitasius commented on Jun 10, 2019

    @nikitasius

    @MarcoFalke why do you want to improve a pretty limited api call (=only for wallet tx) instead of improving a call what exists and does much more? (getrawtransaction).

    gettransaction "txid" ( include_watchonly )
    Get detailed information about in-wallet transaction <txid>
    

    With getrawtransaction i can look for ANY transaction i want:

    image

    Guess best improvements is to allow getrawtransaction to pickup a blockhash automatically from stored data (when users do not use txindex and use prune option).

  2. promag commented on Jun 10, 2019

    @promag
    Contributor

    pickup a blockhash automatically from stored data

    How?

  3. nikitasius commented on Jun 10, 2019

    @nikitasius

    pickup a blockhash automatically from stored data

    How?

    If i store last 8Gb from blockchain on my node, client should be able to work with this 8Gb, otherwise i just waste my space for nothing.

    Thats question to bitcoin devs, HOW they can manage/operate saved data.

  4. sipa commented on Jun 10, 2019

    @sipa
    Member

    @nikitasius Sorry, that's ridiculous. Without index, this means getrawtransaction could essily take minutes or hours to search through the blockchain for your transaction. If you need the data, add an index.

  5. nikitasius commented on Jun 10, 2019

    @nikitasius

    @nikitasius Sorry, that's ridiculous. Without index, this means getrawtransaction could essily take minutes or hours to search through the blockchain for your transaction. If you need the data, add an index.

    @sipa thats why actual txindex should be reworked to be more flexy and more modern. Ridiculous is an actual getrawtransaction implementation what completely worthless on the nodes what prune the data.

    Thats like:

    hey folks, getrawtransaction was unsafe and buggy, but still worked for most of cases. Lets make it stable and ruin all what was build around.

  6. promag commented on Jun 10, 2019

    @promag
    Contributor

    more flexy and more modern

    What you mean??

  7. nikitasius commented on Jun 10, 2019

    @nikitasius

    more flexy and more modern

    What you mean??

    it mean, what when someone run new bitcoin client with txindex and prune options, client build index using pruned data.
    and each time when data is prunes, bitcoin client wipe from index pruned records.

  8. promag commented on Jun 10, 2019

    @promag
    Contributor

    What's the use case for a incomplete tx index? Anyway it's off topic here.

    Concept ACK on decoded data for wallet transactions with a corresponding option.

  9. sidhujag commented on Jun 10, 2019

    @sidhujag

    @nikitasius Sorry, that's ridiculous. Without index, this means getrawtransaction could essily take minutes or hours to search through the blockchain for your transaction. If you need the data, add an index.

    @sipa thats why actual txindex should be reworked to be more flexy and more modern. Ridiculous is an actual getrawtransaction implementation what completely worthless on the nodes what prune the data.

    Thats like:

    hey folks, getrawtransaction was unsafe and buggy, but still worked for most of cases. Lets make it stable and ruin all what was build around.

    All is needed is a new re-org aware index (blockindex) that stores a mapping between the blockhash and txid (a simpler version of txindex) so things like getrawtransaction and gettransaction can do a simple lookup of a tx without storing all the transactions in the index like txindex does. With the rework of gettransaction (ability to pass in the hashBlock) the lookup becomes performant enough imo since its a disk read, most are on SSD's now aswell.

  10. nikitasius commented on Jun 10, 2019

    @nikitasius

    @sidhujag exact.

    Even HDD not an issue, due new code can add index on fly (during loading new tx from blockchan), or run a heavily scan once if there are no index found for pruned data.

    Much more useful to focus resources on this task instead of decoding raw tx in gettransaction call, due getrawtransaction have huge potencial and very universal and useful call.

  11. sipa commented on Jun 10, 2019

    @sipa
    Member

    The reason txindex isn't supported together with pruning is because we haven't heard of any use cases for (another) unreliable index. In my expectation, if you have a need to look up arbitrary transactions, you probably need them for the entire chain. Having it work for an ever-changing set of last few blocks is likely more confusing than helpful.

    If you have a good use case for this, I'm all ears.

  12. jnewbery commented on Jun 10, 2019

    @jnewbery
    Contributor

    No objection to adding additional raw tx data to the wallet's gettransaction RPC method if users think that's useful. Discussion of changes to getrawtransaction should be discussed in #16182.

  13. locked as resolved and limited conversation to collaborators on Dec 16, 2021
  14. added a commit that references this issue on Apr 6, 2023
    4c72e69
  15. added a commit that references this issue on Jul 19, 2026
    f6c3cf1
  16. added a commit that references this issue on Aug 30, 2026
    6a41fa5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions