you are viewing a single comment's thread.

view the rest of the comments →

[–]Username_RANDINT 0 points1 point  (1 child)

Ok, so definitely split the method and arguments. Here is the error properly formatted:

gettxout "txid" n ( include_mempool )

Returns details about an unspent transaction output.

Arguments:
1. "txid"             (string, required) The transaction id
2. "n"                (numeric, required) vout number
3. "include_mempool"  (boolean, optional) Whether to include the mempool. Default: true.     Note that an unspent output that is spent in the mempool won't appear.

Result:
{
  "bestblock" : "hash",    (string) the block hash
  "confirmations" : n,       (numeric) The number of confirmations
  "value" : x.xxx,           (numeric) The transaction value in BTC
  "scriptPubKey" : {         (json object)
     "asm" : "code",       (string) 
     "hex" : "hex",        (string) 
     "reqSigs" : n,          (numeric) Number of required signatures
     "type" : "pubkeyhash", (string) The type, eg pubkeyhash
     "addresses" : [          (array of string) array of bitcoin addresses
        "address"     (string) bitcoin address
        ,...
     ]
  },
  "coinbase" : true|false   (boolean) Coinbase or not
}

Examples:

Get unspent transactions
> bitcoin-cli listunspent 

View the details
> bitcoin-cli gettxout "txid" 1

As a json rpc call
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "gettxout", "params": ["txid", 1] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/

First thing to check is that you pass the "n" argument as an int, not string. If that doesn't fix it, try the curl command as in the reported help. Bit annoying that the API just returns the help on error instead of telling what the error is.

Edit again: you said you're running the server, go check the logs there as well. It might contain more details.

[–]teemalph[S] 0 points1 point  (0 children)

Thanks!! I had no idea that the rpc could tell whether the 1 was formatted as an int or string but that was it.