Developer reviewing smart contract architecture diagrams on a glass wall in a modern WeWork space, standing desk in background, natural industrial aesthetic, candid engineering moment.
Protocols

Decoy Selection Algorithm and Best Practices

How wallets select decoys from the global output distribution to build ring signatures, covering the gamma distribution picker, the 10-block lock rule, and heuristic-breaking patterns that can fingerprint transactions.
introduction
Decoy Selection Algorithm and Best Practices

Introduction

How Monero wallets select decoys from the global output distribution to construct ring signatures, and the implementation patterns that prevent heuristic-based deanonymization.

Monero's transaction privacy relies on ring signatures, which cryptographically hide the true spent output within a set of decoys. The security of this mechanism depends entirely on how wallets select these decoys from the blockchain's historical output distribution. A flawed selection algorithm can introduce statistical anomalies that allow observers to identify the real spent output with high probability, breaking the privacy model for all users. The current standard, introduced to fix critical weaknesses in earlier approaches, mandates a gamma distribution picker that mirrors the empirical age distribution of spent outputs, ensuring that decoy sets are indistinguishable from real spending patterns.

The decoy selection algorithm operates under strict rules defined by the protocol and refined through Monero Research Lab publications. Wallets must select decoys from a recent output set, typically the last 40 million outputs, to reflect current usage patterns. A mandatory 10-block lock time prevents newly created outputs from being used as decoys, mitigating temporal fingerprinting attacks. The algorithm must also avoid heuristic-breaking patterns, such as selecting multiple decoys from the same block or using zero-mixin (non-RingCT) outputs, which would create identifiable anomalies in the ring signature structure. These rules are not enforced by consensus but by wallet implementation standards; a non-compliant wallet only harms its own users' privacy.

For wallet developers, exchange engineers, and custody providers, implementing a correct decoy selection algorithm is one of the highest-stakes integration tasks. A subtle bug in the gamma distribution picker, an incorrect output set window, or a failure to exclude time-locked outputs can create a fingerprint that distinguishes a specific wallet's transactions from the rest of the network. Chainscore Labs can review decoy selection implementations against the canonical Monero Research Lab specifications, audit the output selection logic for known heuristic-breaking patterns, and assess the privacy degradation risk for specific integration architectures.

DECOY SELECTION ALGORITHM

Quick Facts

Key parameters, rules, and risks for wallet developers implementing Monero's decoy selection algorithm to build ring signatures.

AreaWhat changesWho is affectedAction

Distribution Model

Decoys are selected from the global output distribution using a gamma distribution picker, not a uniform random selection.

Wallet developers, privacy researchers

Verify implementation matches the reference gamma distribution parameters to avoid heuristic-breaking patterns.

Output Set Recency

Wallets must use a recent, up-to-date output set to select plausible decoys. Using an old set creates temporal anomalies.

Wallet developers, node operators

Ensure the wallet-rpc daemon is fully synced and the output set is refreshed before transaction construction.

10-Block Lock Rule

Outputs from the most recent 10 blocks are ineligible as decoys to prevent chain-reaction analysis.

Wallet developers, exchange engineers

Implement a hard check to exclude outputs with a confirmation depth of less than 10 blocks from the candidate set.

Same-Block Heuristic

Selecting multiple decoys from the same block creates a strong heuristic that can degrade the effective ring size.

Wallet developers

Ensure the decoy selection algorithm enforces a rule against selecting more than one output from any single block.

Zero-Mixin Avoidance

Including outputs from transactions with a ring size of 1 (zero-mixin) as decoys is a critical privacy leak.

Wallet developers

Filter out all outputs that originate from transactions with a ring size below the enforced minimum.

Ring Size Enforcement

The enforced ring size is a consensus rule. Wallets must construct rings with the exact required number of members.

Wallet developers, exchange infrastructure teams

Hardcode the current minimum ring size and reject any transaction construction that does not meet it.

Fingerprinting Risk

Non-standard decoy selection logic creates a unique wallet fingerprint that can be observed on-chain.

Wallet developers, privacy researchers

Submit decoy selection logic for a specialized review to identify and eliminate any behavioral deviations from the reference implementation.

technical-context
DECOY SELECTION ALGORITHM

The Gamma Distribution Picker

How Monero wallets select plausible decoys from the global output distribution to build ring signatures, and why deviations from the gamma distribution create fingerprinting risks.

Monero's ring signatures rely on a wallet's ability to select decoy outputs that are statistically indistinguishable from the real output being spent. The reference client implements a gamma distribution picker to model the age distribution of spent outputs. This algorithm selects decoys such that their block-time distribution matches the empirical pattern of when outputs are actually spent in the network—most transactions spend relatively recent outputs, with a long tail of older outputs. The gamma distribution's shape and scale parameters are calibrated against observed spending behavior, making it a critical privacy primitive: if a wallet selects decoys using a different distribution, its transactions become identifiable on-chain.

The picker operates within strict consensus and mempool rules. Decoys must be selected from outputs that are at least 10 blocks old (the unlock maturity), cannot be from the same block as the real output, and must be drawn from the global output set rather than a local subset. Wallets that violate these constraints—for example, by selecting decoys from the same block, using zero-mixin (non-ring) transactions, or applying a uniform random selection instead of the gamma distribution—create heuristic-breaking patterns that degrade the anonymity set for all network participants. The 10-block rule is enforced at the protocol level, but distribution fidelity is a wallet implementation responsibility.

For wallet developers and exchange engineers, the operational implication is clear: any custom decoy selection logic must replicate the reference gamma distribution exactly, including its parameterization and edge-case handling. Common failure modes include using an outdated distribution model after a hard fork changes the ring size, applying incorrect age-weighting when rescanning historical blocks, or inadvertently filtering the output set by amount or tx type. Chainscore Labs can review decoy selection implementations for fingerprinting vulnerabilities, verify that output set construction matches the reference client's behavior, and assess whether custom wallet logic introduces statistical anomalies that passive observers can exploit to reduce the effective ring size.

WHO MUST ACT ON DECOY SELECTION CHANGES

Affected Actors

Wallet Developers

Wallet developers are the primary implementers of the decoy selection algorithm. They must ensure their wallet's gamma distribution picker correctly samples from the global output distribution, respects the 10-block lock rule, and avoids heuristic-breaking patterns like selecting multiple decoys from the same block or using zero-mixin transactions.

Action Items:

  • Audit the decoy selection code against the latest Monero Research Lab recommendations.
  • Verify that the output set used for selection is recent and complete.
  • Test for fingerprinting vectors, such as non-standard distribution curves or predictable selection patterns.
  • Implement user-configurable options for decoy ring size if the protocol increases the minimum.

Chainscore can review your decoy selection implementation for fingerprinting vulnerabilities and distribution correctness.

implementation-impact
Decoy Selection Algorithm

Implementation Impact Areas

Areas of direct operational and privacy impact when implementing or modifying the decoy selection algorithm in Monero wallets.

01

Wallet Privacy Model

The decoy selection algorithm directly determines the anonymity set for every transaction. A non-standard or outdated implementation creates a distinct fingerprint that can deanonymize users. Wallet developers must strictly adhere to the reference gamma distribution picker and the 10-block lock rule. Any deviation, such as a custom distribution or an incorrect recent-output window, breaks the uniformity of the anonymity set and makes transactions trivially linkable by observers. Chainscore can audit your selection logic against the canonical distribution to prevent fingerprinting.

02

Output Set Synchronization

The algorithm's security depends on a complete and recent view of the global output set. Wallets relying on a pruned or lagging node will select decoys from a skewed distribution, potentially referencing outputs that are too old or missing recent spendable outputs. This creates a heuristic vulnerability. Operators must ensure the connected monerod instance is fully synced and unpruned for transaction construction. Chainscore can review your node topology to ensure the wallet-rpc instance queries an output set that preserves the intended privacy guarantees.

03

Zero-Mixin Transaction Handling

Pre-RingCT zero-mixin (ring size 1) transactions are provably spent and must never be selected as decoys. Including them in a ring signature instantly reveals the true spent output. The wallet's output selection logic must explicitly filter out these outputs. A failure in this filter is a critical privacy vulnerability that completely breaks the ring signature's hiding property. Chainscore can test your implementation's output filtering logic against known edge cases in the historical blockchain to ensure zero-mixin outputs are never included.

04

Same-Block Decoy Selection

Selecting multiple decoys from the same block creates a strong heuristic that can degrade privacy. The reference algorithm avoids this by ensuring decoys are drawn from distinct blocks. Wallet implementations that inadvertently cluster decoys by time create a statistical anomaly that chain analysis tools can exploit to reduce the effective ring size. Developers must verify their sampling logic enforces block diversity. Chainscore can perform statistical analysis on your wallet's transaction history to detect unintended clustering patterns.

05

Exchange Sweep Privacy

Exchanges performing high-volume sweep transactions are prime targets for chain analysis. Using a non-standard decoy selection algorithm for sweep operations creates a unique temporal and distributional fingerprint that can identify the exchange's hot wallet. This exposes the exchange's entire UTXO set and transaction graph to observers. Exchange infrastructure teams must ensure their programmatic sweep logic uses the exact reference algorithm. Chainscore can assess your sweep engine's decoy selection for operational security and privacy leakage.

06

Hard Fork Consensus Compliance

Monero's mandatory hard forks can change the decoy selection algorithm, such as increasing the minimum ring size. Wallets that fail to upgrade by the activation height will construct invalid transactions that are rejected by the network. This causes a service outage for any dependent exchange, payment processor, or custody platform. Operators must track upgrade requirements in advance. Chainscore provides upgrade readiness reviews to ensure your transaction construction logic is compliant with the latest consensus rules before the fork activates.

DECOY SELECTION VULNERABILITIES

Risk Matrix: Heuristic-Breaking Patterns

Common implementation errors in decoy selection algorithms that create fingerprinting vectors, weaken ring signature anonymity sets, and expose transaction graphs to probabilistic analysis.

PatternFailure ModeAffected ActorsSeverityMitigation

Zero-mixin (mixin 0) transactions

Transaction uses no decoys, making the true spent output trivially identifiable on-chain

Wallet developers, exchanges, payment processors

Critical

Enforce minimum ring size of 16 in wallet construction logic; reject zero-mixin inputs during transaction validation

Decoys selected from same block as real output

Creates temporal clustering that narrows the anonymity set to outputs created in a single block window

Wallet developers, privacy researchers

High

Ensure gamma distribution picker samples across the full output distribution without block-level correlation; audit selection logic for time-biased sampling

Non-standard gamma distribution parameters

Custom or misconfigured distribution parameters create a selection fingerprint unique to a specific wallet implementation

Wallet developers, exchange infrastructure teams

High

Use the reference gamma distribution parameters from the official Monero client; verify selection output against known-good distributions during integration testing

Decoy selection from recent outputs only

Ignoring older outputs creates a temporal heuristic that excludes the majority of the UTXO set, shrinking the effective anonymity set

Light wallet providers, mobile wallet developers

High

Ensure the output selection algorithm queries the full global output distribution, not just a recent window; validate that decoy ages span multiple epochs

Deterministic or predictable decoy selection

Using a weak or predictable random number generator allows an adversary to reproduce decoy selection and identify the real output

Wallet developers, hardware wallet firmware teams

Critical

Use cryptographically secure randomness (e.g., wallet's spend key as entropy source); never seed decoy selection with timestamp or block hash alone

Reusing decoys across multiple transactions from same wallet

Creates a linkable pattern where the same decoy outputs appear repeatedly, allowing an observer to cluster transactions to the same wallet

Exchange sweep engines, high-volume payment processors

Medium

Implement output selection with replacement across the full distribution; avoid caching or reusing recent decoy sets between transactions

Ignoring the 10-block lock rule for decoys

Selecting outputs less than 10 blocks old as decoys creates invalid transactions that fail consensus, or reveals wallet behavior if consistently avoided

Exchange infrastructure teams, wallet developers

Medium

Filter candidate outputs to exclude those with less than 10 confirmations; validate lock height against current chain tip before transaction construction

Selecting decoys from outputs with known spend status

Using outputs that are provably spent (via key image observation) as decoys reduces the effective ring size for chain-analysis adversaries

All wallet implementations, blockchain analysts

Medium

Maintain a local spent-output cache from observed key images; exclude known-spent outputs from the decoy candidate set during selection

DECOY SELECTION AUDIT

Wallet Developer Implementation Checklist

A practical checklist for wallet developers to validate their decoy selection implementation against Monero's consensus rules and privacy-preserving best practices. Each item identifies a critical check, explains why it matters, and specifies the signal or artifact that confirms readiness.

What to check: The wallet's decoy picker must sample offsets from a gamma distribution, not a uniform or arbitrary distribution. Verify the shape and scale parameters match the reference implementation in monero/src/wallet/wallet2.cpp.

Why it matters: A non-standard distribution creates a fingerprint that can distinguish your wallet's transactions from the rest of the network. Chainalysis firms and adversaries actively look for statistical anomalies in decoy selection to break ring signature privacy.

Readiness signal: Generate 10,000+ mock decoy selections and run a Kolmogorov-Smirnov test against the reference implementation's output. The distributions must be statistically indistinguishable. Document the p-value threshold used.

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.

DECOY SELECTION FAQ

Frequently Asked Questions

Common questions from wallet developers and exchange engineers implementing Monero's decoy selection algorithm. Covers the gamma distribution, output set management, and heuristic-breaking patterns that can compromise user privacy.

The gamma distribution models real spending behavior more accurately than a uniform distribution. In practice, most outputs are spent relatively soon after creation, with a long tail of older outputs being spent less frequently. If a wallet selected decoys uniformly across all available outputs, a transaction using an unusually old real output would stand out because the decoys would be statistically improbable. The gamma distribution ensures that the age of the decoys matches the expected age of the real output, preventing temporal fingerprinting. The specific gamma parameters (shape: 19.28, rate: 1.61) were derived from empirical analysis of the Monero blockchain before ring signatures became mandatory. Wallet implementations must use these exact parameters to avoid creating a distinguishable selection pattern.

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.