can’t decode large raw transactions #4099

issue dooglus openend this issue on April 27, 2014
  1. dooglus commented at 8:21 pm on April 27, 2014: contributor

    Here’s a large transaction:

    https://blockchain.info/tx/9873d0244d71b3358a04675e033d3405e48bfcfe7b65166c34f2942b1ca0e41f

    It’s around 67 kB.

    Running this:

    0$ bitcoind getrawtransaction 9873d0244d71b3358a04675e033d3405e48bfcfe7b65166c34f2942b1ca0e41f
    

    gives me 133,920 hex digits of raw transaction. If I try to decoderawtransaction I’m told:

    0bash: bitcoind: Argument list too long
    

    It appears (http://www.linuxjournal.com/article/6060?page=0,1) that the Linux kernel limits command lines to 128kB by default, and that’s the limit I’m running up against here.

    It would be useful if there was some way of decoding a transaction giving just the transaction ID, so I don’t have to copy the huge hex string output and feed it back in as input.

    Maybe decodetransaction would be a good name for it, and it would basically just getrawtransaction and then decoderawtransaction.

    All I really need is the scriptPubKey of a particular output of the transaction, and so would be happy with an RPC call that just grabs that, taking a txid and vout as arguments, but that’s probably overly specific.

    Alternatively, if bitcoin-cli had an option to read its parameters from stdin, that would work too, and allow arbitrarily large amounts of input.

  2. dooglus commented at 8:27 pm on April 27, 2014: contributor

    I just tried the same in the console window of the Qt app and it’s even worse. In there the input buffer stops accepting input at 32767 characters. So I don’t see any way at all of decoding the transaction to gain access to the scriptPubKey of the transaction output that was sent to me.

    I guess I could just use listunspent, since that includes the scriptPubKey.

  3. gmaxwell commented at 8:29 pm on April 27, 2014: contributor

    It would be useful if there was some way of decoding a transaction giving just the transaction ID,

    getrawtransaction 1

    (see help getrawtransaction)

  4. dooglus commented at 8:31 pm on April 27, 2014: contributor

    Huh!

    Thanks. :)

  5. laanwj commented at 1:51 am on April 28, 2014: member

    This is not a limitation of the API, but of the way that you call it. The kernel has a maximum argument length (as you say), and Qt has a maximum line length (both for sanity reasons).

    You can work around this with a Python script that calls the RPC. For example, adapt contrib/bitrpc/bitrpc.py. I’ve done so succesfully in the past for very large transactions. (or you may could forego decoderawtransaction completely and use the transaction decoding in python-bitcoinlib)

    Closing this as I don’t see this as an issue with Bitcoin Core itself, and it can be easily worked around.

  6. laanwj closed this on Apr 28, 2014

  7. DrahtBot locked this on Sep 8, 2021

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-12-22 03:12 UTC

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