Author

Topic: How to get information about a transaction (bitcoin qt rpc) (Read 2320 times)

jr. member
Activity: 77
Merit: 1
Great! Thanks so much - it worked :-)

I hope this will be found in Google and help people in the future!
legendary
Activity: 3472
Merit: 4801
Try decoderawtransaction.

https://en.bitcoin.it/wiki/Raw_Transactions

Quote
getrawtransaction [verbose=0]
If verbose=0, returns serialized, hex-encoded data for transaction txid. If verbose is non-zero, returns a JSON Object containing information about the transaction. Returns an error if is unknown.

decoderawtransaction
Returns JSON object with information about a serialized, hex-encoded transaction.
jr. member
Activity: 77
Merit: 1
I can use the getrawtransaction and get a response. My result for the 2nd transaction made:

01000000010000000000000000000000000000000000000000000000000000000000000000fffff fff0704ffff001d0104ffffffff0100f2052a0100000043410496b538e853519c726a2c91e61ec1 1600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf6 21e73a82cbf2342c858eeac00000000

How would I go around and convert that to useful information? :-) There might be some relevant method, but I have been looking for some time now.

(Thanks A LOT for helping by the way)
legendary
Activity: 3472
Merit: 4801
I think you need to use getrawtransaction to get transactions that are not to or from addresses in your wallet.dat.

See here (emphasis added by me):

- snip -
in version 0.6.3 and earlier, gettransaction would only return information about transactions in your wallet, and would not return all of the information about the transaction.

A month or two ago Pieter and Luke wrote code to modify gettransaction/getblock to return information about any transaction in the blockchain
- snip -

- snip -
"get any transaction, even transactions that aren't in your wallet" functionality will be moved from gettransaction to a new 'getrawtransaction' API call
- snip -
jr. member
Activity: 77
Merit: 1
Ok, my experience:
I cannot get transactions OUTSIDE my wallet... Any ideas how to do that?
jr. member
Activity: 77
Merit: 1
Danny:
Unfortunately, yes. Should it be working by the TX-id like i've described? 
legendary
Activity: 3472
Merit: 4801
That looks like the transactionID of the genesis transaction.  I'm not sure, but I don't think the Bitcoin-Qt wallet allows you to get that transaction. Have you tried with other transactionID and had the same issue?
jr. member
Activity: 77
Merit: 1
I am a newbie when it comes to Bitcoin qt, so the question might show that :-)

I am iterating blocks in the blockchain, and builds up a list of transactions. I do this by reading the JSON response of a block:

var transactions = response["result"]["tx"];

So a tx example is:
4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b

Now I want to find information about this transaction (how many Bitcoins was transfered).

I am trying to call the "gettransaction" function with the tx above as a parameter.. However I get a "Invalid or non-wallet transaction id (code -5)".

So I guess there is something very obvious I've missed? :-) Any guesses?


Jump to: