<p>It sounds like you are passing the whole transaction on the command line, but your operating system has a limit on the maximum (combined) length of command line arguments, which has been exceeded. The message "Argument list too long" is an OS error, not from bitcoind itself.</p>

<p>You should be able to use the <code>-stdin</code> argument from <code>bitcoin-cli</code> to pass it via standard input instead of on the command line, in which case there are no length limits.  On a Unix-like operating system, you'll likely want to pass the data via a pipe, using <code>popen(3)</code> or its equivalent in your language of choice, but you could also write to a temporary file.</p>

CC BY-SA 4.0
2018-10-09T14:05:15.647Z
2018-10-09T14:05:15.647Z
Nate Eldredge
<p>Bitcoind can accept very long inputs, but if you are using bitcoin-cli there is a limit on how long a command-line argument can be.  You can use the -stdin option to send the arguments to bitcoin-cli vis stdin and bypass the size limit on arguments.</p>

CC BY-SA 4.0
2018-10-10T13:21:08.963Z
2018-10-10T13:21:08.963Z
G. Maxwell
<p>There are libraries for deserializing transactions out there.</p>
<p>pybitcointools - python</p>
<p>bitwasp/bitcoin-php - php</p>
<p>libbitcoin - C++/C</p>
<p>OUTDATED: bitcoin-lib-php - php</p>
<p>There's bound to be many others.</p>

CC BY-SA 3.0
2015-12-15T12:58:17.800Z
Do you know of any in JavaScript? For example, can Bitcore deserialise transactions?
Randomblue
CC BY-SA 4.0
2014-04-13T20:03:51.647Z
2020-10-03T02:15:53.457Z
2020-10-03T02:15:53.457Z
karimkorun
<p>try this:</p>

<pre><code>bitcoind getrawtransaction 2f50fdf7adbf58e91d738869948f4b191eb3cafa016c6df7e9182c06e4513852 1
</code></pre>

<p>note the <strong>1</strong> at the end, which instructs bitcoind to operate in verbose mode.</p>

CC BY-SA 4.0
2014-02-11T15:54:04.543Z
2018-10-09T16:26:48.467Z
2018-10-09T16:26:48.467Z
Boombastic
<p>I'm parsing the blockchain to extract certain information I need for a script.</p>

<p>One thing I do is parsing transactions. What I do is:</p>

<pre><code>getrawtransaction &lt;tx&gt;
decoderawtransaction &lt;rawtx&gt;
</code></pre>

<p>This works on most of the transactions (>99%) but some are very huge and the bitcoin client cant handle them. I wonder what else can handle them if not bitcoind itself. The error I get in bitcoind:</p>

<pre><code>TX decode failed (code -22)
</code></pre>

<p>Thats because it cant accept very long arguments. My ruby script dies with</p>

<pre><code>Arguement list too long - (Errno::E2BIG)
</code></pre>

<p>How to decode such transactions? Here are some examples:</p>

<pre><code>2f50fdf7adbf58e91d738869948f4b191eb3cafa016c6df7e9182c06e4513852
e7229316b5a5b1f53382ec5a526b842dda2ca96bc891cd02d397a52c4a84dba0
540359af779a510828f0afd3c88562b62c37d0e4eeccb08104a167a3600f7956
</code></pre>

<p>Thanks.</p>

<hr>

<p>Update: I just tried to paste the rawtransaction to <a href="https://coinb.in/decode-raw-transaction.html" rel="nofollow">this online parser</a> and this one decodes that transaction without any problems. How is that possible programmatically?</p>

<transactions><blockchain><script><error><raw-transaction>
How to decode very huge (!) raw transactions?
q9f
# How to decode very huge (!) raw transactions?

(Asked by: username_0 on 2014-01-01)

I'm parsing the blockchain to extract certain information I need for a script.

One thing I do is parsing transactions. What I do is:

```
getrawtransaction <tx>
decoderawtransaction <rawtx>

```

This works on most of the transactions (>99%) but some are very huge and the bitcoin client cant handle them. I wonder what else can handle them if not bitcoind itself. The error I get in bitcoind:

```
TX decode failed (code -22)

```

Thats because it cant accept very long arguments. My ruby script dies with

```
Arguement list too long - (Errno::E2BIG)

```

How to decode such transactions? Here are some examples:

```
2f50fdf7adbf58e91d738869948f4b191eb3cafa016c6df7e9182c06e4513852
e7229316b5a5b1f53382ec5a526b842dda2ca96bc891cd02d397a52c4a84dba0
540359af779a510828f0afd3c88562b62c37d0e4eeccb08104a167a3600f7956

```

Thanks.

---

Update: I just tried to paste the rawtransaction to [this online parser](https://coinb.in/decode-raw-transaction.html) and this one decodes that transaction without any problems. How is that possible programmatically?

**Tags:** transactions, blockchain, script, error, raw-transaction


---

## 4 answers

### Answer by username_5 on 2014-02-11. Score: 7 | Accepted answer

try this:

```
bitcoind getrawtransaction 2f50fdf7adbf58e91d738869948f4b191eb3cafa016c6df7e9182c06e4513852 1

```

note the **1** at the end, which instructs bitcoind to operate in verbose mode.


---

### Answer by username_1 on 2018-10-09. Score: 2

It sounds like you are passing the whole transaction on the command line, but your operating system has a limit on the maximum (combined) length of command line arguments, which has been exceeded. The message "Argument list too long" is an OS error, not from bitcoind itself.

You should be able to use the `-stdin` argument from `bitcoin-cli` to pass it via standard input instead of on the command line, in which case there are no length limits. On a Unix-like operating system, you'll likely want to pass the data via a pipe, using `popen(3)` or its equivalent in your language of choice, but you could also write to a temporary file.


---

### Answer by username_2 on 2018-10-10. Score: 1

Bitcoind can accept very long inputs, but if you are using bitcoin-cli there is a limit on how long a command-line argument can be. You can use the -stdin option to send the arguments to bitcoin-cli vis stdin and bypass the size limit on arguments.


---

### Answer by username_3 on 2014-04-13. Score: 0

There are libraries for deserializing transactions out there.

pybitcointools - python

bitwasp/bitcoin-php - php

libbitcoin - C++/C

OUTDATED: bitcoin-lib-php - php

There's bound to be many others.

> **Comments:**
> **username_4**: Do you know of any in JavaScript? For example, can Bitcore deserialise transactions?  

---

