How to get the transaction ID for a given output (from the transaction I am looking for)?
-
1See get_outs and this QA.– jtgrassie ♦Jul 27, 2021 at 14:16
-
@jtgrassie thanks for answer but I get a empty txid in JSON response from /get_outs– needprayfornotaxesJul 27, 2021 at 14:43
-
@jtgrassie ok, nevermind I have not noticed in documentation there is "get_txid" param, thanks a lot!– needprayfornotaxesJul 27, 2021 at 15:16
-
2jtgrassie, you probably want to add that as an answer ?– user36303Jul 27, 2021 at 16:20
-
1I wouldn't say "fun fact", rather it just show's I missed typing the param in the example. Glad you're sorted now anyway.– jtgrassie ♦Jul 27, 2021 at 20:58
1 Answer
You can use the RPC method get_outs with the input parameter get_txid
set to true.
A concrete example:
$ curl -X POST http://127.0.0.1:18081/get_outs \
-d '{"get_txid":true,"outputs":[{"index":5164903},{"index":7719180}]}' \
-H 'Content-Type: application/json'
{
"credits": 0,
"outs": [{
"height": 1545783,
"key": "6dcc42839619ea4e1b1cb1b28d45659916207a445ec00e06ece45a7b7bfc1264",
"mask": "449ce062721cbde5f282eeb292eb27636539b29c81a396fddeede73c72d0a66e",
"txid": "124f70eb30ace64d577d82f193e0057b07fc4bdb053bf228dfc00b4e1099b1f1",
"unlocked": true
},{
"height": 1694891,
"key": "1089839b83fd45f7ab87a64398aad45176be4e6ee44872cf37c544358904d61c",
"mask": "3f22409779524a01dc998e58fbccb58a02ca37e6e6be784f11d7b67dbdaf87e3",
"txid": "4b1580e241b5499dd19faebc6c3c2dbf9bbb8a6c8144f538863fb3e71db10bd1",
"unlocked": true
}],
"status": "OK",
"top_hash": "",
"untrusted": false
}