3

This SE answer explains the "key_offsets".

Is there any RPC call to translate theses offsets to their matching outputs ?

Moroccan Engineer
  • 2,968
  • 2
  • 11
  • 34

1 Answers1

7

The method is get_outs.

Here is an example of a query:

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

Result:

{
    "outs": [{
        "height": 141288,
        "key": "29a5f6af06999f1c61c97a415c4ac02a38be8a09be090a76fcf5abc2dad3fc1e",
        "mask": "e9aa7c81cdb5b3148fb7628063cd7a07d1add1643cedd3fa34479d859cc56265",
        "txid": "87dec17ae302c75d202ebcf7bac0d2c295573ec5976b253106fe48ee082c292e",
        "unlocked": true
     }],
     "status": "OK"
}

In addition, RPC method gettransactions return an array of offsets that uses a differential encoding, like :

"key": {
    "amount": 1111111111,
    "key_offsets": [ 103, 46, 15, 24, 36 ],
    "k_image": "6fc468a7e6205ec3acece150343a2b1971743f8292ca51b04079950d975a1da0"
}

Before querying get_outs, the array should be interpreted as

[ 103, 149, 164, 188, 224 ]
Moroccan Engineer
  • 2,968
  • 2
  • 11
  • 34