1

Is there any way that we can do an API call to the Monero daemon RPC to get all the ring members for a given transaction hash?

1

After calling get_transactions, you will have a list of the ring members in the vin.key_offsets field. You can then lookup these outputs using a call to get_outs.

An example of both calls:

curl -X POST http://127.0.0.1:18081/get_transactions -d '{"txs_hashes":["a6eb34ec1893ce43630efc2f2dfa98cde2d5e7f37c18d1d8303f3a6436a4cc9f"],"decode_as_json":true}' -H 'Content-Type: application/json

Returns 5164903, 2019770, 392759, 121787, 5621, 4659, 833, 1353, 6326, 487, 682 as the key_offsets (the ring members).

Each output after the first is incremented by the sum of the previous indexes. So the first member is at index 5164903, the 2nd at 7184673 and so on.

So translated, these outputs are then:

5164903, 7184673, 7577432, 7699219, 7704840, 7709499, 7710332, 7711685, 7718011, 7718498, 7719180

To get further information on each ring member, you can then call get_outs like following (which gets the first and last):

curl -X POST http://127.0.0.1:18081/get_outs -d '{"outputs":[{"index":5164903},{"index":7719180}]}' -H 'Content-Type: application/json'

Which returns:

{
  "outs": [{
    "height": 1545783,
    "key": "6dcc42839619ea4e1b1cb1b28d45659916207a445ec00e06ece45a7b7bfc1264",
    "mask": "449ce062721cbde5f282eeb292eb27636539b29c81a396fddeede73c72d0a66e",
    "txid": "124f70eb30ace64d577d82f193e0057b07fc4bdb053bf228dfc00b4e1099b1f1",
    "unlocked": true
  },{
    "height": 1694891,
    "key": "1089839b83fd45f7ab87a64398aad45176be4e6ee44872cf37c544358904d61c",
    "mask": "3f22409779524a01dc998e58fbccb58a02ca37e6e6be784f11d7b67dbdaf87e3",
    "txid": "4b1580e241b5499dd19faebc6c3c2dbf9bbb8a6c8144f538863fb3e71db10bd1",
    "unlocked": true
  }],
  "status": "OK",
  "untrusted": false
}
  • if there are different key_offset fields.. so do we still add it up? – Sri davei Dec 4 '18 at 22:54
  • 1
    If there was another vin in the tx (thus with it's own key_offsets field), it get's calculated/transformed in the same way - there is no relation to any other vin.key_offsets in the tx - each set of key_offsets is independent. Each offset in the set is the sum of the previous offsets in the set. – jtgrassie Dec 5 '18 at 2:08
  • 1
    Calculation is as I described. Give me a tx id and I can show you the translation. – jtgrassie Dec 6 '18 at 12:45
  • 1
    Firstly those are both very old transactions (pre-RingCT), however, calculation is still as I described. [272] translates to 272. The fact there are two vins each with separate key_offsets with [272], they are referring to the same output (which happen to be in a block with only a coinbase tx - block 00000273). – jtgrassie Dec 7 '18 at 21:53
  • 1
    Block height 1220517 – jtgrassie Dec 8 '18 at 21:22

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.