<p><code>getrawtransaction</code> requires little endian format of the trxid, like:</p>

<pre><code>import bitcoin.rpc
from bitcoin.core import lx
p = bitcoin.rpc.Proxy(service_url='http://usr:pa@ip:port')
trxid = lx('7e195aa3de827814f172c362fcf838d92ba10e3f9fdd9c3ecaf79522b311b22d')
rawtrx = p.getrawtransaction(trxid)
print(rawtrx)
</code></pre>

<p>Comments from Mr Peter Todd on that:</p>

<p><a href="https://github.com/petertodd/python-bitcoinlib/blob/master/examples/spend-p2pkh-txout.py#L41" rel="nofollow noreferrer">https://github.com/petertodd/python-bitcoinlib/blob/master/examples/spend-p2pkh-txout.py#L41</a></p>

CC BY-SA 3.0
2018-04-12T13:10:22.143Z
2018-04-12T13:10:22.143Z
flck
<p>I am running a bitcoin node on my machine, fully synced with RPC commands enabled, rpc server live and txindex=1. </p>

<p>In the command-line I can run the following RPC call and obtain the information about the transaction I require. I am using the cli as I need to process 2.5 million transactions. </p>

<p><code>./bitcoin-cli decoderawtransaction $(./bitcoin-cli getrawtransaction b601fc820d66b6516f89557fba9b40943df962de96b914547dec72b0f047c2f3)</code></p>

<p>Which returns a JSON output of the transaction. </p>

<p>However, when run with the python-bitcoinlib library it seems to give the following error message</p>

<p><code>import bitcoin, bitcoin.rpc
bitcoin.SelectParams("mainnet")
rpc = bitcoin.rpc.Proxy()
rpc.getrawtransaction("b601fc820d66b6516f89557fba9b40943df962de96b914547dec72b0f047c2f3")</code></p>

<blockquote>
  <p>InvalidParameterError: {u'message': u'parameter 1 must be of length 64 (not 128)', u'code': -8}</p>
</blockquote>

<p>What am I doing wrong, isn't b601.. the transaction id?</p>

<p>Edit: As per comment
I fixed it by replacing <code>rpc=bitcoin.rpc.Proxy()</code> with <code>rpc=bitcoin.rpc.RawProxy()</code>. But I would still like to know why the previous fails. </p>

CC BY-SA 3.0
2017-09-04T13:07:00.287Z
I fixed it by replacing `rpc=bitcoin.rpc.Proxy()` with `rpc=bitcoin.rpc.RawProxy()`. But I would still like to know why the previous fails
Oonah
CC BY-SA 3.0
2017-10-17T11:30:42.097Z
I suppose there's a difference parsing the hexstring when you use Proxy vs. RawProxy.
rny
<bitcoin-core><transactions><bitcoin-cli><python-bitcoinlib>
What is the required input for python-bitcoinlib getrawtransaction command?
Oonah
# What is the required input for python-bitcoinlib getrawtransaction command?

(Asked by: username_0 on 2017-09-04)

I am running a bitcoin node on my machine, fully synced with RPC commands enabled, rpc server live and txindex=1.

In the command-line I can run the following RPC call and obtain the information about the transaction I require. I am using the cli as I need to process 2.5 million transactions.

`./bitcoin-cli decoderawtransaction $(./bitcoin-cli getrawtransaction b601fc820d66b6516f89557fba9b40943df962de96b914547dec72b0f047c2f3)`

Which returns a JSON output of the transaction.

However, when run with the python-bitcoinlib library it seems to give the following error message

`import bitcoin, bitcoin.rpc
bitcoin.SelectParams("mainnet")
rpc = bitcoin.rpc.Proxy()
rpc.getrawtransaction("b601fc820d66b6516f89557fba9b40943df962de96b914547dec72b0f047c2f3")`

> InvalidParameterError: {u'message': u'parameter 1 must be of length 64 (not 128)', u'code': -8}

What am I doing wrong, isn't b601.. the transaction id?

Edit: As per comment
I fixed it by replacing `rpc=bitcoin.rpc.Proxy()` with `rpc=bitcoin.rpc.RawProxy()`. But I would still like to know why the previous fails.

**Tags:** bitcoin-core, transactions, bitcoin-cli, python-bitcoinlib

> **Comments:**
> **username_0**: I fixed it by replacing `rpc=bitcoin.rpc.Proxy()` with `rpc=bitcoin.rpc.RawProxy()`. But I would still like to know why the previous fails  
> **username_1**: I suppose there's a difference parsing the hexstring when you use Proxy vs. RawProxy.  

---

## 1 answers

### Answer by username_2 on 2018-04-12. Score: -2

getrawtransaction requires little endian format of the trxid, like:
import bitcoin.rpc
from bitcoin.core import lx
p = bitcoin.rpc.Proxy(service_url='http://usr:pa@ip:port')
trxid = lx('7e195aa3de827814f172c362fcf838d92ba10e3f9fdd9c3ecaf79522b311b22d')
rawtrx = p.getrawtransaction(trxid)
print(rawtrx)

Comments from Mr Peter Todd on that:
https://github.com/petertodd/python-bitcoinlib/blob/master/examples/spend-p2pkh-txout.py#L41


---

