Someone setting up a hardware wallet for the first time, packaging on desk, laptop with wallet interface, afternoon home office light, casual unboxing moment.
Protocols

Key Image Verification and Management

A technical playbook for using key images as the sole privacy-preserving mechanism to detect spent outputs. Covers generation, import, and scanning patterns for exchange security engineers and custody infrastructure teams.
introduction
PRIVACY'S OPERATIONAL CONSTRAINT

The Spend-Detection Problem in Monero

Why detecting spent outputs is the central challenge for any exchange, custody provider, or auditor integrating Monero, and how key images solve it without breaking privacy.

In transparent blockchains like Bitcoin, detecting when a previously received output has been spent is trivial: an auditor or watch-only wallet simply scans the ledger for a transaction consuming that specific UTXO. Monero's privacy model makes this impossible by design. Ring signatures, stealth addresses, and RingCT conceal the sender, receiver, and amount of every transaction. An observer with a view-only wallet—holding only the secret view key—can identify incoming transactions and decrypt their amounts, but cannot determine if those funds have been subsequently moved. This creates a critical operational gap for exchanges, custody providers, and compliance teams who must monitor for unauthorized withdrawals from cold or semi-cold storage without exposing spend authority to an online system.

The protocol's solution is the key image. A key image is a cryptographically unique, one-way derived value generated from an output's secret key during spending. It is published in every transaction that consumes an output, serving as a provable marker that the output was spent, without revealing which output in the ring signature was the real one. This allows a dual-control architecture: a cold, offline system holds the secret spend key and can pre-generate a set of key images for all received outputs. These key images are then imported into a hot, view-only wallet. The hot wallet scans every new block for these key images; if one appears, it signals that a specific output has been spent, triggering an alert for unauthorized activity. This import_key_images workflow is the canonical pattern for spend detection in Monero custody infrastructure.

Implementing this correctly requires careful management of the key image lifecycle. Key images must be generated deterministically from the correct output keys and kept synchronized with the wallet's output set. A failure to import key images for newly received outputs creates a blind spot where funds can be drained without detection. Conversely, a key image appearing on-chain that was not pre-imported indicates a critical security event: either a compromise of the spend key or a bug in the synchronization pipeline. Chainscore Labs reviews key image generation, import, and scanning pipelines for exchanges and custody providers, ensuring that the spend-detection gap is closed and that operational security assumptions hold against real-world attack patterns.

SPENT OUTPUT DETECTION

Key Image Quick Facts

How key images enable privacy-preserving detection of spent outputs and what operators must verify to prevent unauthorized withdrawals.

AreaWhat changesWho is affectedAction

Key Image Generation

Derived from private spend key and output; unique per output

Wallet developers, custody providers

Verify derivation matches canonical implementation

View-Only Wallet Limitation

Cannot detect outgoing spends without importing key images

Exchange compliance teams, auditors

Implement key image import pipeline for complete monitoring

Key Image Import

Manual or automated import of key images from signing wallet

Custody infrastructure teams

Automate import to detect unauthorized spends in real time

Double-Spend Prevention

Network rejects any transaction containing a key image already in the spent set

Node operators, exchange wallet operators

Monitor for key image reuse attempts as intrusion signal

Synchronization Lag

Key image set only updates on confirmed blocks; reorgs can invalidate

Exchange security engineers

Handle reorgs by re-scanning key image set after chain reorganization

Hardware Wallet Integration

Key image must be generated on-device during transaction signing

Hardware wallet firmware teams

Audit on-device key image generation for side-channel leakage

Key Image Export Format

Binary format; must be serialized correctly for RPC and file transfer

Exchange engineers, wallet integrators

Validate serialization matches monero-wallet-rpc export format

Unauthorized Sweep Detection

Unexpected key image appearing in spent set indicates compromise

Custody security teams, incident responders

Alert on any key image appearing without corresponding authorization

technical-context
THE SPENT-OUTPUT NULLIFIER

Key Image Generation and On-Chain Semantics

How Monero nodes prevent double-spends without revealing which output is being spent, and why correct key image generation is the single most critical operation for wallet and custody security.

In Monero, a key image is a deterministic, one-way cryptographic value derived from a specific output's one-time public key and the recipient's private spend key. It serves as the protocol's sole mechanism for preventing double-spends while preserving sender ambiguity. When a transaction is constructed, the wallet computes the key image I = x * H_p(P), where x is the private spend key and P is the output's one-time public key. This image is included in the transaction data and is checked by every node against a global set of all previously seen key images. If a match is found, the transaction is rejected as a double-spend attempt. Critically, the mathematical relationship between a key image and the output it represents is unlinkable without knowledge of the private keys, meaning an observer cannot determine which output in the ring is the true one being consumed.

For exchanges and custody providers, key image management is the linchpin of a secure view-only wallet architecture. A view-only wallet—armed with the private view key but not the spend key—can detect incoming transactions by scanning for outputs destined for the wallet. However, it is completely blind to outgoing spends. To detect unauthorized withdrawals, operators must periodically export key images from a hot or air-gapped signing environment and import them into the view-only instance. The wallet then scans new blocks, and if any imported key image appears in a transaction, it flags that output as spent. This workflow creates a critical security dependency: if the key image import pipeline fails, is delayed, or is fed incomplete data, the view-only wallet will silently fail to report theft. Chainscore can review this synchronization pipeline for reliability gaps, race conditions, and completeness of coverage across all wallet outputs.

Operational errors in key image generation can lead to permanent fund loss or undetected compromise. A key image must be generated for the exact output being spent; using the wrong private key or a malformed public key will produce a valid-looking but incorrect image that will not match any future on-chain spend, rendering the monitoring system blind to that output's movement. Additionally, the import_key_images RPC call requires precise handling of signed key image data structures. Teams managing large UTXO sets must ensure that key image exports are atomic, verifiable, and tied to specific wallet restore heights to avoid scanning gaps. For hardware wallet integrations, the secure generation of key images on-device—without exposing the spend key to the host—is a non-negotiable security boundary that requires rigorous implementation review.

KEY IMAGE MANAGEMENT IMPACT

Affected Systems and Teams

Exchange Security Engineers

Key images are the sole mechanism for detecting spent outputs in a view-only wallet. Your primary risk is an undetected unauthorized withdrawal from a hot or warm wallet.

Critical Actions:

  • Ensure your monero-wallet-rpc instance is configured to import key images from cold storage at a regular cadence.
  • Validate that your monitoring system alerts on any new key image appearing that was not generated by an authorized sweep transaction.
  • Do not rely solely on balance checks; an attacker who compromises a spend key can drain funds without the balance updating in a view-only wallet until key images are imported.
  • Implement a reconciliation process that compares expected key images from your own sweep transactions against the imported set to detect injection of malicious key images.

Chainscore can review your key image synchronization pipeline for race conditions, completeness of import coverage, and alerting logic to ensure no withdrawal goes undetected.

implementation-impact
KEY IMAGE LIFECYCLE

Integration Architecture and Workflow

A practical model for integrating key image generation, import, and scanning into exchange and custody infrastructure to detect unauthorized spends from view-only wallets.

01

Key Image Generation and Export

Key images are derived from one-time output keys using the wallet's private spend key. For cold or air-gapped setups, the export_key_images command must be executed in the offline signing environment. The resulting signed file is then transferred to the online view-only wallet. Critical: Never expose the private spend key to the online environment; all key image generation must occur on the offline machine to maintain the security boundary.

02

Import and Synchronization Pipeline

The online view-only wallet imports the signed key images file using import_key_images. This populates a local lookup table that the wallet uses to detect outgoing transactions during the next rescan. The wallet must be rescanned from the wallet's creation height to ensure no historical spends are missed. Automate this pipeline to run on a strict schedule, as the gap between a spend and its detection is your window of vulnerability.

03

Continuous Monitoring and Alerting

After the initial import, the view-only wallet will automatically flag any incoming transaction that spends a known output as an 'outgoing' transfer. Integrate with the wallet's RPC or ZeroMQ event stream to trigger real-time alerts on these events. An outgoing transaction in a view-only wallet is a high-severity security signal, potentially indicating a compromised spend key. Immediate automated response, such as pausing deposits, is essential.

04

Handling the 10-Block Lock Period

A newly received output cannot be spent for 10 blocks (~20 minutes). Your key image scanning logic must account for this delay. A transaction that appears to spend an output before this maturity threshold is invalid and will be rejected by the network. Ensure your monitoring system does not generate false-positive alerts for attempted spends of immature outputs, which could indicate a misconfigured wallet rather than a theft.

06

False-Positive and Reorg Resilience

A blockchain reorganization can orphan a block containing your sweep transaction, causing the key image to temporarily disappear from the canonical chain. Your monitoring system must be resilient to this. Instead of a single alert, implement a confirmation-count threshold. A key image should only be considered a confirmed spend after it is buried under a sufficient number of blocks, preventing operational panic during a deep chain reorganization.

KEY IMAGE VERIFICATION AND MANAGEMENT

Failure Mode and Risk Matrix

Operational risks and failure modes for exchange and custody teams managing key image pipelines to detect unauthorized spends from view-only wallets.

Risk AreaFailure ModeAffected ActorsSeverityMitigation and Action

Key Image Import Gap

Imported key images do not cover all historical outputs, leaving spent outputs undetected in the view-only wallet.

Exchange security engineers, custody providers

Critical

Perform a full rescan of the wallet's creation height before enabling monitoring. Verify the count of imported key images matches the total number of outputs ever received.

Stale Key Image Set

Key images are not re-imported after new transactions are constructed by the cold wallet, causing a monitoring blind spot for recent spends.

Custody infrastructure teams, treasury operators

High

Automate a post-signing process that exports new key images from the cold signing environment and imports them into the view-only monitoring instance.

Synchronization Lag

The monitoring wallet-rpc instance is behind the network tip, delaying detection of a malicious spend.

Exchange security operations, compliance teams

High

Monitor the block height of the wallet-rpc instance independently. Set alerts if the sync lag exceeds a strict threshold (e.g., 2 blocks).

RPC Endpoint Compromise

An attacker gains access to the view-only wallet's RPC interface and disables key image checking or alters its output.

Exchange infrastructure architects, security teams

Critical

Strictly firewall the wallet-rpc endpoint. Use TLS and digest authentication. Never expose the RPC interface to the public internet.

False Negative from Reorg

A spend transaction is mined in a block that is later orphaned. The key image is marked as spent, but the output is available again, causing a false alarm or a missed re-spend.

Exchange operators, wallet developers

Medium

Implement reorg-aware logic. On a reorg event, re-verify the spent status of all outputs against the canonical chain and re-import key images if necessary.

Decoy-Induced False Positive

An imported key image coincidentally matches a decoy in another user's ring signature, causing a false alert for an unauthorized spend.

Security engineers, compliance teams

Low

Understand that a key image appearing on-chain is definitive proof of a spend of your output. Investigate all alerts as real spends. This is not a false positive.

Unencrypted Key Image Export

Key images are exported or transferred from the cold signing environment over an insecure channel, leaking future spend intent.

Custody key managers, security auditors

High

Treat exported key images with the same sensitivity as view keys. Transfer them only via QR codes, air-gapped media, or encrypted channels. Chainscore can review the key image transfer pipeline for confidentiality.

View-Only Wallet Misconfiguration

The monitoring wallet is set up with the spend key instead of the view key, or the --trusted-daemon flag is misapplied, creating a false sense of security.

Exchange infrastructure teams, wallet developers

Critical

Verify the wallet's read-only status by attempting a transfer. Document and automate the configuration of the monitoring instance. Chainscore can audit the setup for correctness.

EXCHANGE AND CUSTODY READINESS

Key Image Pipeline Implementation Checklist

A technical checklist for security and infrastructure teams implementing key image scanning pipelines to detect unauthorized withdrawals from view-only wallets. Each item identifies a critical control point, the risk it mitigates, and the signal that confirms correct implementation.

What to check: Verify that the key images imported into the watch-only wallet are cryptographically bound to the outputs being monitored and have not been truncated, reordered, or duplicated during transfer from the cold signing environment.

Why it matters: A malformed or incorrect key image will fail to match a spent output, creating a blind spot where an attacker can spend funds without detection. This is the most common failure mode in air-gapped key image pipelines.

Readiness signal: Import a known spent key image from a test transaction. Confirm that is_key_image_spent returns true and that the wallet balance decrements accordingly. If the balance does not change, the import pipeline is broken.

Chains We Build On

Looking to build on a specific blockchain?

We build smart contracts, DeFi applications, wallets, tokenization platforms, and blockchain infrastructure across the major ecosystems teams choose today. That includes Ethereum, Arbitrum, Optimism, Polygon, Avalanche, Solana, Sui, Aptos, Hedera, Stellar, and NEAR, with support for additional EVM and non-EVM networks based on your product requirements.

EVM ecosystems

  • Ethereum logo
    Ethereum
  • Arbitrum logo
    Arbitrum
  • Optimism logo
    Optimism
  • Polygon logo
    Polygon
  • Avalanche logo
    Avalanche
  • Cronos logo
    Cronos

Non-EVM ecosystems

  • Solana logo
    Solana
  • Sui logo
    Sui
  • Aptos logo
    Aptos
  • Hedera logo
    Hedera
  • Stellar logo
    Stellar
  • NEAR logo
    NEAR

Additional ecosystems

  • Polkadot logo
    Polkadot
  • Cosmos logo
    Cosmos
  • TON logo
    TON
  • Cardano logo
    Cardano
  • Algorand logo
    Algorand
  • Tempo logo
    Tempo

Also available for Base, appchains, custom EVM networks, and cross-chain product architecture.

KEY IMAGE VERIFICATION AND MANAGEMENT

Frequently Asked Questions

Common operational and security questions for exchange engineers and custody providers implementing key image scanning to detect unauthorized withdrawals from view-only wallets.

A view-only wallet possesses only the secret view key. This key can decrypt incoming transaction amounts and identify outputs destined for the wallet, but it cannot compute the key image required to mark an output as spent. The key image is derived from the secret spend key, which is intentionally absent from a view-only setup. Without importing key images, a view-only wallet will see outputs disappear from the unspent set with no corresponding outgoing transaction record, creating a dangerous blind spot for unauthorized withdrawals.

Trusted by Industry Leaders

Delivering blockchain solutions for 5+ years.

We have partnered with 50+ leading DeFi protocols, NFT ecosystems, and fintech innovators to build secure, scalable, and capital-efficient blockchain products.

Selected Partners & Clients

ChainVote logo
Reax logo
Sokail logo
Swapsicle logo
SyntheX logo
Tekika logo
Telos logo
Zexe logo
ChainVote logo
Reax logo
Sokail logo
Swapsicle logo
SyntheX logo
Tekika logo
Telos logo
Zexe logo
ChainVote logo
Reax logo
Sokail logo
Swapsicle logo
SyntheX logo
Tekika logo
Telos logo
Zexe logo
ChainVote logo
Reax logo
Sokail logo
Swapsicle logo
SyntheX logo
Tekika logo
Telos logo
Zexe logo
I've been working with Chainscore Labs for last 3+ years, they've consistently delivered with strong ownership across multiple projects. The team is reliable and detail-oriented.
L
Lee Erswell
CEO, Telos Foundation
how to get started

How to get started?

If you're looking for blockchain integration, ChainScore Labs has 5+ years of experience helping teams build and integrate exchanges, wallets, smart contracts, tokenization solutions, and protocol-connected products, we can help you choose the right path, integrate securely, and get to production faster. Our team consists of experienced blockchain developers and architects who can help you with your blockchain integration needs.

01

Exploration & Strategy

Define your product goals and choose the right blockchain architecture for your use case.

02

Architecture & Design

Design the smart contracts, tokenomics, and security parameters of your system.

03

Development & Integration

Build and integrate with wallets, oracles, and front-end dApps for a seamless experience.

04

Security & Launch

Comprehensive audits followed by a risk-managed mainnet deployment to protect your users.

Start a build

Need a blockchain engineering team?

Send the project context and we will respond with next steps, scope questions, and a practical path to delivery.