Table of Contents

Class ArkContract

Namespace
NArk.Abstractions.Contracts
Assembly
NArk.Abstractions.dll

Base class for all Arkade taproot contracts (VTXO, boarding, delegate, etc.). Subclasses define the script structure; this base handles taproot spend-info derivation and serialization shared across all types.

public abstract class ArkContract
Inheritance
ArkContract
Derived
Inherited Members

Constructors

ArkContract(OutputDescriptor)

Base class for all Arkade taproot contracts (VTXO, boarding, delegate, etc.). Subclasses define the script structure; this base handles taproot spend-info derivation and serialization shared across all types.

protected ArkContract(OutputDescriptor server)

Parameters

server OutputDescriptor

Properties

DefaultScope

The layer this contract type's funds live on by default (on-chain vs off-chain). Abstract so every contract type makes an explicit, compile-time scope decision. Used as the fallback when ToEntity(string, OutputDescriptor?, DateTimeOffset?, ContractActivityState, ContractScope?) is called without a scope override.

public abstract ContractScope DefaultScope { get; }

Property Value

ContractScope

Server

The Arkade server key descriptor. Null for contracts that predate multi-server support.

public OutputDescriptor? Server { get; }

Property Value

OutputDescriptor

Type

Contract type discriminator string (e.g. "vtxo", "boarding").

public abstract string Type { get; }

Property Value

string

Methods

GetArkAddress(OutputDescriptor?)

Derives the bech32m Arkade address for this contract's output pubkey.

public virtual ArkAddress GetArkAddress(OutputDescriptor? defaultServerKey = null)

Parameters

defaultServerKey OutputDescriptor

Returns

ArkAddress

GetContractData()

Returns the key-value map of contract parameters used for serialization.

protected abstract Dictionary<string, string> GetContractData()

Returns

Dictionary<string, string>

GetScriptBuilders()

Returns the script builders for each tapscript leaf in the tree.

protected abstract IEnumerable<ScriptBuilder> GetScriptBuilders()

Returns

IEnumerable<ScriptBuilder>

GetScriptPubKey()

Returns the taproot scriptPubKey for this contract. Unlike GetArkAddress(OutputDescriptor?), this works for all contract types including boarding.

public virtual Script GetScriptPubKey()

Returns

Script

GetTapScriptList()

Returns the compiled tapscript leaves that form this contract's script tree.

public virtual TapScript[] GetTapScriptList()

Returns

TapScript[]

GetTaprootSpendInfo()

Builds the taproot spend info (NUMS internal key + script tree) for this contract.

public virtual TaprootSpendInfo GetTaprootSpendInfo()

Returns

TaprootSpendInfo

ToEntity(string, OutputDescriptor?, DateTimeOffset?, ContractActivityState, ContractScope?)

Projects this contract into a persistable ArkContractEntity.

public ArkContractEntity ToEntity(string walletIdentifier, OutputDescriptor? defaultServerKey = null, DateTimeOffset? createdAt = null, ContractActivityState activityState = ContractActivityState.Active, ContractScope? scopeOverride = null)

Parameters

walletIdentifier string

The wallet that owns the contract.

defaultServerKey OutputDescriptor

Reserved for address derivation parity; not persisted.

createdAt DateTimeOffset?

Creation timestamp; defaults to now.

activityState ContractActivityState

Initial activity state; defaults to Active.

scopeOverride ContractScope?

Per-instance scope override. When null, the entity's effective scope is DefaultScope. The override is write-time only — the persisted column always means "this contract's effective scope."

Returns

ArkContractEntity

ToString()

Serializes the contract as an arkcontract=… query string.

public override string ToString()

Returns

string