4

This is a scenario I've come up with to help me understand key images.

Let's say I have Wallet 1 and Wallet 2. Wallet 1 has TXO A and TXO B. I send TXO A and TXO B as inputs to Wallet 2. TXO B was reduced to pay transaction fees. Then I send TXO A and the updated TXO B as inputs back to Wallet 1. TXO B was reduced further to pay transaction fees. What I'm left with that concerns me is TXO A.

Based on my rudimentary knowledge of key images, I know that a key image was generated as part of the first transaction (the send from Wallet 1 to Wallet 2). That key image, in layman's terms, says that Wallet 1 spent TXO A (and TXO B, of course), so it can no longer spend TXO A again.

But now TXO A is back in Wallet 1, unchanged (as far as I know) from its original glory. Will the key image be different the second time around, so that Wallet 1 is not prevented from spending TXO A again? Does the original key image have an effect on the ability of Wallet 1 to spend TXO A the second time?

(Please recall from the title that I'm interested in the ingredients - perhaps "variables" is the technical term - for how a key image is generated.)

254123179
  • 4,586
  • 4
  • 32
  • 58
scoobybejesus
  • 5,515
  • 21
  • 42

1 Answers1

4

When you send TXO A, it doesn't stay unchanged in wallet 2, it it now a new TXO A2 (with a one time address for wallet 2) that can't be linked with certainty to TXO A because of the ring signature.

According to the CryptoNote whitepaper, the key image is computed from the one-time key pair associated to the transaction output:

I = x*H(P)

where:

I is the key image
x is the one-time private key
P is the one-time public key (point P = x*G)
H is a deterministic hash function

If you try to spend TXO A a second time, the network will reject it because the key image for TXO A will already be in the known key images set. But when you spend TXO A2 (back to wallet 1), it will work fine because the key image for TXO A2 is different from the key image for TXO A (because these two TXOs are associated to different one-time key pair).

dEBRUYNE
  • 15,417
  • 18
  • 60
  • 114
glv
  • 3,364
  • 11
  • 15