Flawed order-matching logic and double-spend incidents represent a critical class of operational failure unique to Bitcoin Ordinals and Runes marketplaces. Unlike native Bitcoin transactions where double-spends are prevented by consensus, the asset layer introduced by these meta-protocols relies on off-chain indexers to interpret ownership. When a marketplace's order-matching engine trusts an indexer state that is not yet final—due to mempool uncertainty, block reorganization, or simple indexer lag—it can list the same inscription or Runes UTXO for sale multiple times, leading to financial losses for buyers who receive nothing after their transaction confirms.

Flawed Order-Matching Logic and Double-Spend Incidents
Introduction
Postmortem analysis of marketplace incidents where indexer lag, mempool state confusion, or flawed backend logic caused a single inscription or Runes UTXO to be sold to multiple buyers.
The root cause typically lies in the architecture of the order-matching pipeline. Marketplaces often use a fast, eventually-consistent indexer view to power their user interface and order book, while settlement occurs against the canonical chain state. An attacker or an unwitting seller can exploit the window between an asset being listed and the indexer recognizing its transfer. In more severe cases, a seller broadcasts a transaction spending the asset to themselves with a low fee, lists the asset for sale, and then replaces the original transaction with a higher-fee version that sends the asset to a buyer, effectively double-selling it. These failure modes are not theoretical; they have resulted in real losses across multiple Ordinals and Runes trading venues.
The operational impact extends beyond immediate financial loss. These incidents erode trust in marketplace infrastructure, force emergency pauses on trading, and require complex manual remediation processes to compensate affected users. For exchange integration teams and custody providers, the risk is amplified because automated trading systems may not have the mempool-level visibility required to detect a pending double-spend before executing a buy order. The lack of a standardized, real-time mempool monitoring and order-verification framework across the ecosystem means each marketplace must independently engineer defenses against these attack patterns.
Chainscore Labs helps marketplace operators, exchange integration teams, and custody providers conduct a rigorous review of their order-matching architecture against these known failure patterns. This includes analyzing indexer finality assumptions, implementing mempool-aware transaction verification, and designing circuit breakers that halt trading when state divergence is detected. For teams building new trading infrastructure, we provide protocol impact assessments and integration planning to ensure these risks are addressed before they result in user losses.
Incident Profile
Postmortem analysis of marketplace incidents where indexer lag, mempool state confusion, or flawed backend logic caused a single inscription or Runes UTXO to be sold to multiple buyers. Examines the failure modes in order-matching engines that rely on off-chain indexers and the resulting financial losses.
| Phase | Signal | Response | Owner |
|---|---|---|---|
Listing | Seller lists an inscription or Runes UTXO on a marketplace, which verifies ownership against its indexer. | Marketplace backend confirms listing and displays it as available for purchase. | Marketplace Operations |
First Sale | Buyer A initiates purchase. Marketplace creates a PSBT or transaction to transfer the UTXO. | Marketplace marks the listing as 'sale pending' or 'sold' in its internal database. | Marketplace Backend |
Indexer Lag Window | The transaction from the first sale is broadcast but not yet confirmed. The marketplace's indexer has not yet processed the mempool transaction and still shows the UTXO as available. | No automated alert is triggered. The listing may remain visible or be relisted by a stale cache. | Indexer Operator / Marketplace Backend |
Second Sale (Double-Spend) | Buyer B purchases the same UTXO. The marketplace backend, relying on the stale indexer state, constructs a second, conflicting transaction. | Both Buyer A and Buyer B now have signed transactions attempting to spend the same UTXO. Only one can confirm. | Marketplace Order-Matching Engine |
Confirmation and Loss | One transaction confirms, transferring the asset to one buyer. The other transaction becomes invalid permanently. | The losing buyer has paid for an asset they will never receive. The seller may have been paid twice if the marketplace pre-funded the second sale. | Marketplace Risk Team |
Dispute and Remediation | The losing buyer files a support ticket. Marketplace investigates the conflicting transactions. | Marketplace must refund the losing buyer from its own treasury or insurance fund. Root cause analysis begins. | Marketplace Support and Security |
Architectural Fix | Postmortem identifies reliance on unconfirmed indexer state as the root cause. | Implement mempool-aware order matching: verify UTXO availability against node mempool state in addition to the indexer before allowing a purchase. | Marketplace Engineering |
Ongoing Monitoring | Recurring double-spend attempts or indexer lag incidents. | Deploy monitoring for UTXO state divergence between indexer and node mempool. Alert on any sale of a UTXO with a conflicting transaction in the mempool. | Marketplace Infrastructure Team |
Root Cause Pattern: The Indexer-Mempool Gap
The fundamental disconnect between Bitcoin's mempool state and off-chain indexer views creates a race condition that marketplace matching engines repeatedly fail to handle.
The recurring double-spend and order-matching incidents in Ordinals and Runes marketplaces share a single root cause: a temporal and semantic gap between the Bitcoin mempool and the off-chain indexer that the marketplace uses to confirm asset ownership. When a seller lists an inscription or Runes UTXO, the marketplace's backend queries an indexer to verify ownership and lock the asset. However, the indexer's view of the UTXO set is not real-time; it lags behind the mempool, where a conflicting transaction—spending the same UTXO to a different buyer or back to the seller—may already be pending. The marketplace's order-matching engine, treating the indexer's stale state as authoritative, approves a second sale of an already-spent asset. This is not a blockchain double-spend in the consensus sense, but an application-layer double-sale enabled by the architecture of relying on an eventually-consistent off-chain database for transaction finality decisions.
The failure manifests in several variants. In the simplest case, a seller broadcasts a transfer of the listed UTXO directly to another wallet after listing it, exploiting the window before the marketplace's indexer observes the spend and cancels the listing. More sophisticated attacks use Replace-By-Fee (RBF) or Child-Pays-For-Parent (CPFP) to dynamically outbid the marketplace's own cancellation or fulfillment transaction in the mempool. The attacker monitors the mempool for the marketplace's transaction, then broadcasts a conflicting transaction with a higher fee rate, causing miners to prefer the attacker's version. The marketplace's indexer, which typically only confirms transactions after one or more block confirmations, remains unaware of the mempool-level race until it is too late. The result is that two buyers believe they have purchased the same asset, with only one receiving it on-chain, while the other is left holding a PSBT or order confirmation that will never settle.
Operationally, this gap means that any marketplace relying solely on indexer state for order validation is vulnerable. Mitigations require integrating direct mempool monitoring—observing unconfirmed transactions that spend the UTXO in question—and implementing probabilistic finality checks before confirming a sale. Some marketplaces have moved to a model where the seller must first transfer the asset into an escrow UTXO controlled by the marketplace's hot wallet or a collaborative custody setup, eliminating the seller's ability to double-spend after listing. Others use time-locked PSBTs with anti-exfiltration commitments that bind the seller to a specific transaction structure. However, these solutions introduce their own trust assumptions and operational complexity. Chainscore Labs can conduct an architecture review of your order-matching engine, indexer integration, and mempool monitoring strategy to identify and close the specific race-condition windows in your marketplace's transaction lifecycle.
Affected Systems and Actors
Marketplace Operators
Marketplaces are the primary victims and vectors for these incidents. The core vulnerability lies in the architecture of their order-matching engines, which rely on off-chain indexers to confirm asset ownership and UTXO state.
Operational Impact:
- Financial liability for double-sold assets, requiring operator compensation.
- Reputational damage and user churn following a public incident.
- Operational burden of pausing markets, invalidating stale listings, and reconciling indexer state.
Required Actions:
- Implement a transaction finality gate: do not mark a listing as sold until the transfer transaction receives a minimum number of confirmations.
- Introduce a mempool-aware state monitor that flags a UTXO as "pending" when it appears in an unconfirmed transaction, preventing concurrent sales.
- Conduct a Chainscore Labs order-matching logic review to identify race conditions between your backend, the indexer API, and the Bitcoin mempool.
Architectural Weaknesses Exploited
Postmortem analysis of marketplace incidents where indexer lag, mempool state confusion, or flawed backend logic caused a single inscription or Runes UTXO to be sold to multiple buyers.
Indexer Lag and Stale State Exploitation
The core failure mode occurs when a marketplace's order-matching engine relies on an off-chain indexer that is trailing the mempool. An attacker can sell an inscription, broadcast a second transaction spending the same UTXO with a higher fee, and have the second transaction confirm while the indexer still shows the asset as available. Marketplace operators must implement a mempool-aware state verification layer that cross-references indexer data with their own full node's mempool before marking an order as fillable. Chainscore Labs can review your order-matching pipeline to identify race conditions between indexer state and mempool reality.
Double-Fill via Concurrent Order Matching
When a single listing receives multiple buy requests within the same block window, a non-atomic order-matching engine can approve and broadcast multiple spends of the same UTXO before any one confirms. This is exacerbated by load-balanced backend instances that do not share a real-time locking mechanism. The fix requires a distributed mutex or database-level advisory lock on the UTXO being traded, with a timeout that accounts for worst-case block inclusion. Teams should audit their order-matching concurrency model—Chainscore Labs provides integration review for exactly-once execution guarantees in UTXO-based marketplaces.
Mempool Replacement Not Detected Before Fill
A seller lists an inscription, then broadcasts a Replace-By-Fee (RBF) transaction that moves the asset to a different wallet. If the marketplace backend does not continuously monitor the mempool for replacement transactions targeting listed UTXOs, it may fill the now-stale listing. Effective mitigation requires a persistent mempool watch on all actively listed UTXOs, with automatic delisting the moment a conflicting transaction is observed. Marketplace operators should validate that their listing lifecycle includes real-time mempool conflict detection—a gap Chainscore Labs can assess in an upgrade readiness review.
Child-Pays-For-Parent Fee Sniping
An attacker observes a pending buy transaction for a high-value inscription and broadcasts a CPFP transaction that spends the same UTXO with a substantially higher aggregate fee rate, causing miners to prefer the attacker's transaction chain. The buyer's transaction is evicted from the mempool while the marketplace has already marked the order as filled. Defenses include post-broadcast confirmation monitoring with automated refund logic if the expected transaction is replaced, and fee strategies that make CPFP displacement economically irrational. Chainscore Labs can review your transaction finality assumptions and mempool strategy.
Reorg-Induced Double-Spend on Indexer State
A Bitcoin blockchain reorganization can invalidate a previously confirmed sale transaction, returning the UTXO to the seller's wallet while the marketplace's indexer—if it does not correctly handle reorgs—still shows the asset as transferred to the buyer. If the seller relists and sells the asset before the indexer catches up, a double-spend occurs. Indexer operators must implement deterministic reorg handling that rolls back state to the common ancestor and replays blocks. Marketplace teams should verify their indexer's reorg behavior and implement a confirmation-depth policy that accounts for chain reorganization risk.
Runes UTXO Splitting and Partial Fill Confusion
Runes tokens are bound to UTXOs, and a single UTXO can carry multiple Runes balances. A flawed order-matching engine may treat a partial-fill scenario incorrectly—splitting the UTXO to send the correct Runes amount to the buyer while inadvertently sending the remaining Runes to a change address that the marketplace does not track. This results in the seller losing access to their residual balance. The fix requires Runes-aware UTXO selection and change-output validation that preserves all non-traded Runes balances in seller-controlled outputs. Chainscore Labs can audit your Runes transaction construction logic for balance preservation correctness.
Risk Assessment Matrix
Evaluates the technical failure modes, affected actors, and required actions for marketplace incidents where indexer lag or flawed backend logic caused a single inscription or Runes UTXO to be sold to multiple buyers.
| Risk Area | Failure Mode | Affected Actors | Mitigation Action |
|---|---|---|---|
Off-Chain Indexer Dependency | Order-matching engine relies on an indexer that is lagging behind the mempool or tip, causing it to list a UTXO as available after it has already been spent in an unconfirmed or recently confirmed transaction. | Marketplace operators, sellers, buyers | Implement direct mempool monitoring and require a minimum number of confirmations before relisting a UTXO. Cross-reference state against a second independent indexer. |
Mempool State Confusion | Backend logic fails to distinguish between a transaction in the mempool and a confirmed transaction, allowing a second order to be matched against a UTXO that is already committed to a pending trade. | Marketplace operators, trading infrastructure teams | Integrate a full mempool view to lock UTXOs at order acceptance, not at broadcast. Use CPFP-aware logic to detect replacement attempts on pending trade transactions. |
Race Condition in Order Acceptance | Two concurrent buy requests are processed against the same listing before either transaction is broadcast, due to a lack of atomic state locking in the order-matching service. | Marketplace backend engineers, buyers | Implement atomic database locks or a FIFO queue for order matching against a specific UTXO. Reject subsequent orders for a UTXO with a pending match status. |
PSBT Lifecycle Mismanagement | A seller signs a PSBT for a trade, but the marketplace fails to invalidate the listing. The seller then signs a second PSBT for a different buyer, creating a double-spend. | Marketplace operators, wallet developers, sellers | Enforce strict listing invalidation upon PSBT generation. Use time-locked PSBTs with short expiry windows to limit the attack surface. Verify UTXO status before counter-signing. |
Replace-By-Fee (RBF) Exploitation | After a trade transaction is broadcast with a low fee, an attacker uses RBF to replace it with a conflicting transaction that spends the same UTXO to themselves, effectively stealing the asset. | Buyers, marketplace operators | Broadcast trade transactions with fee rates sufficient for rapid confirmation. Monitor for conflicting transactions in the mempool and alert users. Consider using first-seen-safe policy or full-RBF awareness. |
Indexer Reorg Handling Failure | A blockchain reorganization invalidates a confirmed trade, but the indexer fails to correctly roll back its state, causing the UTXO to be double-listed or incorrectly marked as spent. | Indexer operators, marketplace operators | Audit indexer reorg-handling logic against known failure patterns. Implement a reconciliation process that verifies UTXO state against a Bitcoin Core node after any reorg event. |
Multi-Indexer State Divergence | Two different indexer implementations disagree on the location or ownership of a UTXO, allowing a seller to list the same asset on two marketplaces that rely on different indexers. | Marketplace operators, cross-platform traders, indexer operators | Do not rely on a single indexer implementation for asset verification. Cross-reference state against a canonical Bitcoin node and at least one alternative indexer before finalizing a trade. |
Remediation and Prevention Checklist
A practical checklist for marketplace operators and integration teams to harden their order-matching engines against the double-spend and state-confusion failure modes observed in Ordinals and Runes incidents. Each item identifies a specific vulnerability, explains why it matters, and provides the signal or artifact that confirms readiness.
What to check: Your order-matching engine must not treat an unconfirmed transaction as final simply because a single indexer has seen it. Indexers can lag, fork, or process transactions in different orders.
Why it matters: The primary failure mode in double-spend incidents is a backend accepting an indexer's view of a 'pending' transaction as proof of payment, while the Bitcoin network has either not seen the transaction or has seen a conflicting one with a higher fee.
Confirmation signal: Implement a multi-source confirmation pipeline that cross-references the transaction's status against at least two independent Bitcoin nodes (preferably with different mempool policies) and the indexer API. The transaction must be seen in the mempools of your own nodes before the order is matched. For high-value assets, require at least one on-chain confirmation before finalizing the trade.
Source Resources and Further Reading
Use these primary resources to validate inscription and Runes state, transaction replacement behavior, PSBT construction, and mempool monitoring. Marketplace teams should test their own order lifecycle against the referenced rules rather than treating an indexer or pending transaction as authoritative settlement.
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
- Arbitrum
- Optimism
- Polygon
- Avalanche
- Cronos

Non-EVM ecosystems
- Solana
- Sui
- Aptos
- Hedera
- Stellar
- NEAR
Additional ecosystems
- Polkadot
- Cosmos
- TON
- Cardano
- Algorand
- Tempo
Also available for Base, appchains, custom EVM networks, and cross-chain product architecture.
Frequently Asked Questions
Common questions from marketplace operators, exchange integration teams, and custody providers investigating flawed order-matching logic and double-spend incidents in Ordinals and Runes infrastructure.
The root cause is typically a mismatch between the marketplace's off-chain order-matching engine and the Bitcoin mempool state. Marketplaces often rely on indexer APIs to confirm asset availability, but indexers can lag behind the mempool or experience state divergence. When a seller broadcasts a transaction spending an inscribed UTXO or Runes balance, the indexer may not immediately reflect this, allowing the same asset to be matched with multiple buyers. The second buyer's transaction then either fails to confirm or, in more complex scenarios, replaces the first via RBF/CPFP, resulting in a double-spend. The core failure is treating indexer state as authoritative for transaction finality rather than waiting for sufficient block confirmations or implementing mempool-aware locking mechanisms.
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
“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.”
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.
Exploration & Strategy
Define your product goals and choose the right blockchain architecture for your use case.
Architecture & Design
Design the smart contracts, tokenomics, and security parameters of your system.
Development & Integration
Build and integrate with wallets, oracles, and front-end dApps for a seamless experience.
Security & Launch
Comprehensive audits followed by a risk-managed mainnet deployment to protect your users.
Discover our
blockchain development services.
We build production-grade blockchain solutions for top-tier projects across DeFi and Web3.
Need a blockchain engineering team?
Send the project context and we will respond with next steps, scope questions, and a practical path to delivery.


