Bitcoin Forum
May 05, 2024, 07:04:47 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: ”Argument list too long“ for decoderawtransaction  (Read 1059 times)
mhps (OP)
Hero Member
*****
Offline Offline

Activity: 516
Merit: 500


CAT.EX Exchange


View Profile
June 24, 2016, 05:47:55 AM
 #1

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?




|(
▄▄██████████▄▄
▄██████████████████▄
▄█████▀ ▀█████▀ ▀██████▄
██████ ███ ▀▀▀ ███ ███████
██████▀▄███████████▄▀███████
███████ █████████████ ████████
███████ █████████████ ████████
████████▄▀█████████▀▄█████████
██████████▄ █████ ▄█▀▄▄▄▀█████
██████████ ████▌▐█ █▀▄█ ████
████████▌▐█████ █▌▐█▄▄████
▀█████▀ ██████▄ ▀ █████▀
▀██████████████████▀
▀▀██████████▀▀
)(.
)
▌   ANNOUNCE THREAD   ▌▐   BOUNTY   ▐
TWITTER  |  FACEBOOK  |  TELEGRAM  |  DISCORD
(((((((   MOBILE APP [ ANDROID / IOS ]   )))))))
)
1714935887
Hero Member
*
Offline Offline

Posts: 1714935887

View Profile Personal Message (Offline)

Ignore
1714935887
Reply with quote  #2

1714935887
Report to moderator
1714935887
Hero Member
*
Offline Offline

Posts: 1714935887

View Profile Personal Message (Offline)

Ignore
1714935887
Reply with quote  #2

1714935887
Report to moderator
"With e-currency based on cryptographic proof, without the need to trust a third party middleman, money can be secure and transactions effortless." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714935887
Hero Member
*
Offline Offline

Posts: 1714935887

View Profile Personal Message (Offline)

Ignore
1714935887
Reply with quote  #2

1714935887
Report to moderator
1714935887
Hero Member
*
Offline Offline

Posts: 1714935887

View Profile Personal Message (Offline)

Ignore
1714935887
Reply with quote  #2

1714935887
Report to moderator
1714935887
Hero Member
*
Offline Offline

Posts: 1714935887

View Profile Personal Message (Offline)

Ignore
1714935887
Reply with quote  #2

1714935887
Report to moderator
cr1776
Legendary
*
Offline Offline

Activity: 4032
Merit: 1299


View Profile
June 24, 2016, 11:54:02 AM
 #2

What does
getconf ARG_MAX

Show?


There may not be another solution except recompiling since I don't think xargs would help here.
theymos
Administrator
Legendary
*
Offline Offline

Activity: 5194
Merit: 12972


View Profile
June 25, 2016, 05:08:55 AM
Merited by TheArchaeologist (1)
 #3

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.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
mhps (OP)
Hero Member
*****
Offline Offline

Activity: 516
Merit: 500


CAT.EX Exchange


View Profile
June 28, 2016, 08:37:00 AM
 #4

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.




|(
▄▄██████████▄▄
▄██████████████████▄
▄█████▀ ▀█████▀ ▀██████▄
██████ ███ ▀▀▀ ███ ███████
██████▀▄███████████▄▀███████
███████ █████████████ ████████
███████ █████████████ ████████
████████▄▀█████████▀▄█████████
██████████▄ █████ ▄█▀▄▄▄▀█████
██████████ ████▌▐█ █▀▄█ ████
████████▌▐█████ █▌▐█▄▄████
▀█████▀ ██████▄ ▀ █████▀
▀██████████████████▀
▀▀██████████▀▀
)(.
)
▌   ANNOUNCE THREAD   ▌▐   BOUNTY   ▐
TWITTER  |  FACEBOOK  |  TELEGRAM  |  DISCORD
(((((((   MOBILE APP [ ANDROID / IOS ]   )))))))
)
hassan_pf
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
August 19, 2018, 06:10:00 AM
 #5

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
gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4158
Merit: 8382



View Profile WWW
August 19, 2018, 05:39:51 PM
 #6

bitcoin-cli has the -stdin argument for this reason. (both too long inputs and keeping passwords off command lines...)
TheArchaeologist
Sr. Member
****
Offline Offline

Activity: 310
Merit: 727


---------> 1231006505


View Profile WWW
August 21, 2018, 08:13:11 AM
 #7

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 <mysecretpassphrase> <unlock time in seconds>

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.

Sooner or later you're going to realize, just as I did, that there's a difference between knowing the path and walking the path
TheArchaeologist
Sr. Member
****
Offline Offline

Activity: 310
Merit: 727


---------> 1231006505


View Profile WWW
August 21, 2018, 08:20:02 AM
 #8

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?

Sooner or later you're going to realize, just as I did, that there's a difference between knowing the path and walking the path
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!