Table of Contents

Class IndexerVtxoDiscoveryProvider

Namespace
NArk.Core.Recovery
Assembly
NArk.Core.dll

Discovery provider that asks arkd's indexer whether any VTXO (spent or unspent) is recorded against the contracts derivable from a given HD index. A single VTXO at any state is sufficient evidence the index was used.

To recover funds locked under legacy script formats, this derives and probes more than the current default contract — mirroring the canonical arkade-os/ts-sdk restore. For each index it builds, for every signer in { current SignerKey } ∪ DeprecatedSigners (server-key rotation leaves old funds under a different script):

On mainnet the candidate set also pairs each signer with the historical 7-day unilateral-exit delay (605184s) alongside the arkd-advertised one — matching ts-sdk's MAINNET_UNILATERAL_EXIT_DELAY fallback. arkd only advertises the CURRENT delay; without this, wallets that minted VTXOs while mainnet still ran the original delay would silently fail discovery after the operator shortened it. We keep one hardcoded fallback rather than scanning an unbounded history because arkd does not record deprecated delays.

Every candidate whose script the indexer reports a VTXO for is returned so the orchestrator persists it.

public class IndexerVtxoDiscoveryProvider : IContractDiscoveryProvider
Inheritance
IndexerVtxoDiscoveryProvider
Implements
Inherited Members

Constructors

IndexerVtxoDiscoveryProvider(IClientTransport, RecoveryDelegateConfig?, ILogger<IndexerVtxoDiscoveryProvider>?)

Discovery provider that asks arkd's indexer whether any VTXO (spent or unspent) is recorded against the contracts derivable from a given HD index. A single VTXO at any state is sufficient evidence the index was used.

To recover funds locked under legacy script formats, this derives and probes more than the current default contract — mirroring the canonical arkade-os/ts-sdk restore. For each index it builds, for every signer in { current SignerKey } ∪ DeprecatedSigners (server-key rotation leaves old funds under a different script):

On mainnet the candidate set also pairs each signer with the historical 7-day unilateral-exit delay (605184s) alongside the arkd-advertised one — matching ts-sdk's MAINNET_UNILATERAL_EXIT_DELAY fallback. arkd only advertises the CURRENT delay; without this, wallets that minted VTXOs while mainnet still ran the original delay would silently fail discovery after the operator shortened it. We keep one hardcoded fallback rather than scanning an unbounded history because arkd does not record deprecated delays.

Every candidate whose script the indexer reports a VTXO for is returned so the orchestrator persists it.

public IndexerVtxoDiscoveryProvider(IClientTransport clientTransport, RecoveryDelegateConfig? delegateConfig = null, ILogger<IndexerVtxoDiscoveryProvider>? logger = null)

Parameters

clientTransport IClientTransport
delegateConfig RecoveryDelegateConfig
logger ILogger<IndexerVtxoDiscoveryProvider>

Properties

Name

Short identifier used in log lines and the recovery report (e.g. "indexer", "boarding").

public string Name { get; }

Property Value

string

Methods

DiscoverAsync(ArkWalletInfo, OutputDescriptor, int, CancellationToken)

Probe whether any contract derivable from userDescriptor at index has ever been used.

public Task<DiscoveryResult> DiscoverAsync(ArkWalletInfo wallet, OutputDescriptor userDescriptor, int index, CancellationToken cancellationToken = default)

Parameters

wallet ArkWalletInfo

The HD wallet being recovered.

userDescriptor OutputDescriptor

The output descriptor at the given index — concrete (no remaining /*), already derived from wallet.AccountDescriptor.

index int

The derivation index being probed.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<DiscoveryResult>

A DiscoveryResult describing whether the index was used and, if so, the reconstructed contracts to persist.