Getting transaction data from sendwithdata

+4 votes

Is there a way to get data information of a random transaction using the API without knowing the addresses involved in it? 

I'm interested in obtaining some plain hex data I encode in a transaction using sendwithdata.
I tried using gettxout and gettransaction but  both seem to omit the data field 

The command getaddresstransaction displays the hex data without problem, but I want to be able to get the data without the address involved.

I can get the data using getblock blocknumber 4 but this is really cumbersome, as the output is usually huge compared to what I need to read.

asked Jul 17, 2017 by b2

1 Answer

+1 vote
Best answer

If the transaction involves an address tracked by this node, you can use getwallettransaction which doesn't require you to provide the specific address used. You can also use getrawtransaction with verbose=1, which will work on any node so long as the txindex runtime parameter has been left on its default value of 1.

answered Jul 18, 2017 by MultiChain