What is a Key Image?

Learn about Double Spending Issue and Key Image.

What is a Key Image?

Key Image is a cryptographic key that prevents double spending on Privacy Blockchains.

In the previous text, we explained what ring signatures are and how viewers can’t tell which input is the ‘’right’’ one because they all look the same. But if they can’t differentiate the right one from the decoys, how can they prevent double-spending?

That’s exactly why the Key Image exists. Key Image is a key made from the output that was spent. Each output has its cryptographically created Key Image, and there is one Key Image per each output. That means that there can be multiple Key Images per transaction. This is how Key Images look on the Blockchain:

Key Images Safex Blockchain Explorer

While each Output has a specific Key Image assigned to it, the outside observer cannot distinguish which output came from which wallet address due to the obfuscation characteristics of one-time stealth addresses used in the transaction formation. This allows outputs to get used in transactions without revealing their origin. A list of the Key Images is preserved on the blockchain, and that’s how nodes can confirm that the same Safex Cash or Safex Token output is not spent twice. If someone tries to spend the same output twice, the node receiving the transaction request will immediately throw a Double Spend error (after it sees the Key Image has already been used previously) and refuse to let the transaction enter the Transaction Pool.

Double Spending Issue: Key image on Privacy Blockchain

Example:

Dan wants to send 1,000 Safex Cash using the Safex Wallet. He writes Ivana’s public address in the wallet where the coins should be sent and enters the amount. Mixin is 7, which means that 7 decoys from the blockchain are contributing to making the ring signature. That makes a group of 8 possible signers. No one, not even the receiver, can’t be sure if the output was signed by a real signer or some of 7 decoys. However, using the Key Image, nodes can confirm the 1000 Safex Cash that Dan is sending were not spent before. This is how Key Image is preventing double-spending.