Table of Contents

Class VHTLCContract

Namespace
NArk.Core.Contracts
Assembly
NArk.Core.dll
[Obsolete("Use VHTLCv2 from ArkadeIntents package")]
public class VHTLCContract : ArkContract
Inheritance
VHTLCContract
Inherited Members

Constructors

VHTLCContract(OutputDescriptor, OutputDescriptor, OutputDescriptor, uint160, LockTime, Sequence, Sequence, Sequence)

public VHTLCContract(OutputDescriptor server, OutputDescriptor sender, OutputDescriptor receiver, uint160 hash, LockTime refundLocktime, Sequence unilateralClaimDelay, Sequence unilateralRefundDelay, Sequence unilateralRefundWithoutReceiverDelay)

Parameters

server OutputDescriptor
sender OutputDescriptor
receiver OutputDescriptor
hash uint160
refundLocktime LockTime
unilateralClaimDelay Sequence
unilateralRefundDelay Sequence
unilateralRefundWithoutReceiverDelay Sequence

VHTLCContract(OutputDescriptor, OutputDescriptor, OutputDescriptor, byte[], LockTime, Sequence, Sequence, Sequence)

public VHTLCContract(OutputDescriptor server, OutputDescriptor sender, OutputDescriptor receiver, byte[] preimage, LockTime refundLocktime, Sequence unilateralClaimDelay, Sequence unilateralRefundDelay, Sequence unilateralRefundWithoutReceiverDelay)

Parameters

server OutputDescriptor
sender OutputDescriptor
receiver OutputDescriptor
preimage byte[]
refundLocktime LockTime
unilateralClaimDelay Sequence
unilateralRefundDelay Sequence
unilateralRefundWithoutReceiverDelay Sequence

Fields

ContractType

public const string ContractType = "HTLC"

Field Value

string

Properties

DefaultScope

VHTLC funds live off-chain as a VTXO.

public override ContractScope DefaultScope { get; }

Property Value

ContractScope

Hash

public uint160 Hash { get; }

Property Value

uint160

Preimage

public byte[]? Preimage { get; }

Property Value

byte[]

Receiver

Output descriptor for the receiver key.

public OutputDescriptor Receiver { get; }

Property Value

OutputDescriptor

RefundLocktime

public LockTime RefundLocktime { get; }

Property Value

LockTime

Sender

Output descriptor for the sender key.

public OutputDescriptor Sender { get; }

Property Value

OutputDescriptor

Type

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

public override string Type { get; }

Property Value

string

UnilateralClaimDelay

public Sequence UnilateralClaimDelay { get; }

Property Value

Sequence

UnilateralRefundDelay

public Sequence UnilateralRefundDelay { get; }

Property Value

Sequence

UnilateralRefundWithoutReceiverDelay

public Sequence UnilateralRefundWithoutReceiverDelay { get; }

Property Value

Sequence

Methods

Create(OutputDescriptor, OutputDescriptor, OutputDescriptor, byte[], LockTime, VHtlcDelay, VHtlcDelay, VHtlcDelay)

Creates a VHTLC contract from raw parameters, validating hash byte length and seconds timelocks before encoding them into NBitcoin types (which lose the original value on rounding).

public static VHTLCContract Create(OutputDescriptor server, OutputDescriptor sender, OutputDescriptor receiver, byte[] preimageHashBytes, LockTime refundLocktime, VHtlcDelay unilateralClaimDelay, VHtlcDelay unilateralRefundDelay, VHtlcDelay unilateralRefundWithoutReceiverDelay)

Parameters

server OutputDescriptor
sender OutputDescriptor
receiver OutputDescriptor
preimageHashBytes byte[]
refundLocktime LockTime
unilateralClaimDelay VHtlcDelay
unilateralRefundDelay VHtlcDelay
unilateralRefundWithoutReceiverDelay VHtlcDelay

Returns

VHTLCContract

CreateClaimScript()

public ScriptBuilder CreateClaimScript()

Returns

ScriptBuilder

CreateCooperativeScript()

public ScriptBuilder CreateCooperativeScript()

Returns

ScriptBuilder

CreateRefundWithoutReceiverScript()

public ScriptBuilder CreateRefundWithoutReceiverScript()

Returns

ScriptBuilder

CreateUnilateralClaimScript()

public ScriptBuilder CreateUnilateralClaimScript()

Returns

ScriptBuilder

CreateUnilateralRefundScript()

public ScriptBuilder CreateUnilateralRefundScript()

Returns

ScriptBuilder

CreateUnilateralRefundWithoutReceiverScript()

public ScriptBuilder CreateUnilateralRefundWithoutReceiverScript()

Returns

ScriptBuilder

GetContractData()

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

protected override Dictionary<string, string> GetContractData()

Returns

Dictionary<string, string>

GetScriptBuilders()

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

protected override IEnumerable<ScriptBuilder> GetScriptBuilders()

Returns

IEnumerable<ScriptBuilder>

Parse(Dictionary<string, string>, Network)

public static ArkContract? Parse(Dictionary<string, string> contractData, Network network)

Parameters

contractData Dictionary<string, string>
network Network

Returns

ArkContract

ToCoopRefundCoin(string, ArkVtxo)

public ArkCoin ToCoopRefundCoin(string walletIdentifier, ArkVtxo vtxo)

Parameters

walletIdentifier string
vtxo ArkVtxo

Returns

ArkCoin