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
serverOutputDescriptor
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
Server
The Arkade server key descriptor. Null for contracts that predate multi-server support.
public OutputDescriptor? Server { get; }
Property Value
Type
Contract type discriminator string (e.g. "vtxo", "boarding").
public abstract string Type { get; }
Property Value
Methods
GetArkAddress(OutputDescriptor?)
Derives the bech32m Arkade address for this contract's output pubkey.
public virtual ArkAddress GetArkAddress(OutputDescriptor? defaultServerKey = null)
Parameters
defaultServerKeyOutputDescriptor
Returns
GetContractData()
Returns the key-value map of contract parameters used for serialization.
protected abstract Dictionary<string, string> GetContractData()
Returns
GetScriptBuilders()
Returns the script builders for each tapscript leaf in the tree.
protected abstract IEnumerable<ScriptBuilder> GetScriptBuilders()
Returns
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
walletIdentifierstringThe wallet that owns the contract.
defaultServerKeyOutputDescriptorReserved for address derivation parity; not persisted.
createdAtDateTimeOffset?Creation timestamp; defaults to now.
activityStateContractActivityStateInitial activity state; defaults to Active.
scopeOverrideContractScope?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
ToString()
Serializes the contract as an arkcontract=… query string.
public override string ToString()