Author

Topic: ”Argument list too long“ for decoderawtransaction (Read 1078 times)

sr. member
Activity: 310
Merit: 727
---------> 1231006505
hi,

I get an ”Argument list too long“ shell error when running

$BITCOIND decoderawtransaction $foo

where $foo is a raw tx that is 158kb long from getrawtransaction, on Ubuntu linux. How to get around it w/o recompiling the kernel?

So what happpens if you do:
Code:
$BITCOIND -stdin decoderawtransaction
$foo
And CTRL-D afterwards?
sr. member
Activity: 310
Merit: 727
---------> 1231006505
Can I add password in it , so that it don't prompt for password . i know its not safe , but i need to add password

If you are asking to run rpc calls without supplying the needed rpc-user and password each time add them to your bitcoin.conf file:
Code:
rpcuser=hassan_pf
rpcpassword=nobodyknows
This is the preferred way since it won't show up in your bash history (opposed to using them as arguments when calling bitcoin-cli)

However if you are looking for a way to unlock your wallet so you can spent coins you should use the walletpassphrase argument. The insecure way of doing this is:
Code:
bitcoin-cli walletpassphrase  

So if you want to unlock your wallet with passphrase "secretenough" for 5 minutes you should do:
Code:
bitcoin-cli walletpassphrase secretenough 300

However this means your passphrase is also stored in your bash history, something you might not want. As gmaxwell was referring to you can use the -stdin argument if you don't want this to happen. The way this works is:

Code:
bitcoin-cli -stdin walletpassphrase
Once entered pass every argument you want to supply on a seperate line like this:
Code:
secretenough
300
 
Use CTRL-D after supplying all the arguments. This will unlock your wallet without the passphrase getting written to your bash history.
staff
Activity: 4284
Merit: 8808
bitcoin-cli has the -stdin argument for this reason. (both too long inputs and keeping passwords off command lines...)
newbie
Activity: 1
Merit: 0
Can I add password in it , so that it don't prompt for password . i know its not safe , but i need to add password
hero member
Activity: 516
Merit: 500
CAT.EX Exchange
I think that this should work, though I haven't tested it.

Thanks. It works!  I removed the -H part to get json format output, where the decoded raw tx is in the "result" field.
I also changed -data-binary to -data so that it doesn't matter if the hex tx has a \n in it.
administrator
Activity: 5222
Merit: 13032
The bottom of help decoderawtransaction shows you how to execute the command using JSON-RPC via curl:

Code:
curl --user myusername --data-binary \
'{"jsonrpc": "1.0", "id":"curltest", "method": "decoderawtransaction", "params": ["hexstring"] }' -H 'content-type: text/plain;'\
 http://127.0.0.1:8332/

You can put the {"jsonrpc":... stuff into a file (omit the single quotes) named for example TEMPFILE and then change the command to:
Code:
curl --user myusername --data-binary @TEMPFILE -H 'content-type: text/plain;' http://127.0.0.1:8332/

This requires that you set an RPC user and password in your bitcoin.conf. Change "myusername" above to your actual RPC user.

Since the data is in a file and never passed through the shell, I think that this should work, though I haven't tested it.
legendary
Activity: 4256
Merit: 1313
What does
getconf ARG_MAX

Show?


There may not be another solution except recompiling since I don't think xargs would help here.
hero member
Activity: 516
Merit: 500
CAT.EX Exchange
hi,

I get an ”Argument list too long“ shell error when running

$BITCOIND decoderawtransaction $foo

where $foo is a raw tx that is 158kb long from getrawtransaction, on Ubuntu linux. How to get around it w/o recompiling the kernel?
Jump to: