Let's assume I have an address, a secret view key for it, and a transaction. The transaction has been checked by a daemon to be valid.

How do I figure out if the transaction pays something (and how much) to the address? What are the operations I need to perform?

PS: I'm asking only about v11 and v12 protocol.

Additional info:

It's not obvious in the explanation below that some transactions have more than one pubkey. Specifically, it happens when the tx pays out to multiple subaddresses. A good explanation of what additional data should be processed is in this question

1 Answer 1


Extract the tx public key R from the tx extra field, and for each output, it's key K and index i, then using your private view key a and public spend key B, you own the output if:

Hs(8aR||i)G+B == K

To find out how much you received, take the encrypted amount e for that output index from the transaction's ecdhInfo field and decrypt:

xor8(e, keccak("amount"||Hs(8aR||i))

Note, xor8 is XOR'ing the first parameter with the first 8 bytes of the second parameter, the result is the decrypted amount.

  • Thanks! Does 8 in 8aR stand for scalar multiplication?
    – emesik
    Commented Oct 21, 2019 at 7:54
  • 1
    It's a point multiplication. (ge_mul8).
    – jtgrassie
    Commented Oct 21, 2019 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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