Table of Contents

Class ArkCoin

Namespace
NArk.Abstractions
Assembly
NArk.Abstractions.dll

A spendable VTXO with the spending script, contract, and expiry data the SDK needs to participate in a batch or perform an offchain send.

public class ArkCoin : Coin, ICoin, ICoinable
Inheritance
Coin
ArkCoin
Implements
ICoin
ICoinable
Inherited Members
Coin._OverrideScriptCode
Coin.GetScriptCode()
Coin.GetHashVersion()
Coin.ToScriptCoin(Script)
Coin.TryToScriptCoin(Script)
Coin.TryToScriptCoin(PubKey)
Coin.ToColoredCoin(AssetMoney)
Coin.OverrideScriptCode(Script)
Coin.IsMalleable
Coin.CanGetScriptCode
Coin.Outpoint
Coin.TxOut
Coin.Amount
Coin.ScriptPubKey

Constructors

ArkCoin(ArkCoin)

public ArkCoin(ArkCoin other)

Parameters

other ArkCoin

ArkCoin(string, ArkContract, DateTimeOffset, DateTimeOffset?, uint?, OutPoint, TxOut, OutputDescriptor?, ScriptBuilder, WitScript?, LockTime?, Sequence?, bool, bool, IReadOnlyList<VtxoAsset>?)

public ArkCoin(string walletIdentifier, ArkContract contract, DateTimeOffset birth, DateTimeOffset? expiresAt, uint? expiresAtHeight, OutPoint outPoint, TxOut txOut, OutputDescriptor? signerDescriptor, ScriptBuilder spendingScriptBuilder, WitScript? spendingConditionWitness, LockTime? lockTime, Sequence? sequence, bool swept, bool unrolled, IReadOnlyList<VtxoAsset>? assets = null)

Parameters

walletIdentifier string
contract ArkContract
birth DateTimeOffset
expiresAt DateTimeOffset?
expiresAtHeight uint?
outPoint OutPoint
txOut TxOut
signerDescriptor OutputDescriptor
spendingScriptBuilder ScriptBuilder
spendingConditionWitness WitScript
lockTime LockTime?
sequence Sequence?
swept bool
unrolled bool
assets IReadOnlyList<VtxoAsset>

Properties

Assets

Ark-issued assets attached to this coin; null for BTC-only coins.

public IReadOnlyList<VtxoAsset>? Assets { get; }

Property Value

IReadOnlyList<VtxoAsset>

Birth

When this coin was first observed.

public DateTimeOffset Birth { get; }

Property Value

DateTimeOffset

Contract

The on-chain contract that encumbers this coin.

public ArkContract Contract { get; }

Property Value

ArkContract

ExpiresAt

Wall-clock expiry; null when expiry is block-height only.

public DateTimeOffset? ExpiresAt { get; }

Property Value

DateTimeOffset?

ExpiresAtHeight

Block-height expiry; null when expiry is time-based only.

public uint? ExpiresAtHeight { get; }

Property Value

uint?

LockTime

Transaction locktime required when spending, or null.

public LockTime? LockTime { get; }

Property Value

LockTime?

Sequence

Input sequence required for OP_CSV leaves; null for non-CSV scripts.

public Sequence? Sequence { get; }

Property Value

Sequence?

SignerDescriptor

Output descriptor used to sign spends of this coin.

public OutputDescriptor? SignerDescriptor { get; }

Property Value

OutputDescriptor

SpendingConditionWitness

Additional witness data prepended to the script path witness, when required by the spending condition.

public WitScript? SpendingConditionWitness { get; }

Property Value

WitScript

SpendingScript

Compiled tapscript leaf for spending.

public TapScript SpendingScript { get; }

Property Value

TapScript

SpendingScriptBuilder

Builds the tapscript leaf used when spending this coin.

public ScriptBuilder SpendingScriptBuilder { get; }

Property Value

ScriptBuilder

Swept

True if the Arkade server has already swept this coin's VTXO on-chain.

public bool Swept { get; }

Property Value

bool

Unrolled

True if this coin came from the unilateral-exit (unroll) path rather than a batch.

public bool Unrolled { get; }

Property Value

bool

WalletIdentifier

Owner wallet ID.

public string WalletIdentifier { get; }

Property Value

string

Methods

CanSpendOffchain(TimeHeight)

True when the coin can participate in an offchain Arkade intent (not yet expired or swept).

public bool CanSpendOffchain(TimeHeight current)

Parameters

current TimeHeight

Returns

bool

CanSpendOffchain(TimeHeight, IReadOnlyDictionary<ECXOnlyPubKey, long>)

As CanSpendOffchain(TimeHeight), but additionally excludes coins under a deprecated signer past its cutoff (IsDeprecatedSignerPastCutoff(IReadOnlyDictionary<ECXOnlyPubKey, long>, long)): past the cutoff the operator stops co-signing, so the coin is no longer offchain-spendable even though it is not yet recoverable.

public bool CanSpendOffchain(TimeHeight current, IReadOnlyDictionary<ECXOnlyPubKey, long> deprecatedSigners)

Parameters

current TimeHeight
deprecatedSigners IReadOnlyDictionary<ECXOnlyPubKey, long>

Returns

bool

FillPsbtInput(PSBT)

Populates the PSBT input for this coin with taproot spend-info and condition witness. Returns null if this coin's outpoint is not in the PSBT.

public PSBTInput? FillPsbtInput(PSBT psbt)

Parameters

psbt PSBT

Returns

PSBTInput

GetRawExpiry()

Returns expiry as a raw number: unix seconds for time-gated, block height for height-gated, 0 if no expiry.

public double GetRawExpiry()

Returns

double

IsDeprecatedSignerPastCutoff(IReadOnlyDictionary<ECXOnlyPubKey, long>, long)

True when this coin's contract is bound to a deprecated Arkade server signer whose cooperative-sign cutoff has already passed — the operator will no longer co-sign an offchain spend, so the coin can only be redeemed once it becomes recoverable (after expiry). A cutoff of 0 means "no cutoff" and is never treated as past.

public bool IsDeprecatedSignerPastCutoff(IReadOnlyDictionary<ECXOnlyPubKey, long> deprecatedSigners, long nowUnixSeconds)

Parameters

deprecatedSigners IReadOnlyDictionary<ECXOnlyPubKey, long>

Deprecated signer pubkeys mapped to their cutoff (unix seconds), from ArkServerInfo.DeprecatedSigners.

nowUnixSeconds long

The current time in unix seconds.

Returns

bool

IsRecoverable(TimeHeight)

True when the coin must be redeemed on-chain (swept or past expiry).

public bool IsRecoverable(TimeHeight current)

Parameters

current TimeHeight

Returns

bool

RequiresForfeit()

True when spending this coin offchain requires submitting a forfeit transaction.

public bool RequiresForfeit()

Returns

bool