Table of Contents

Class ArkadeCash

Namespace
NArk.Abstractions
Assembly
NArk.Abstractions.dll

An ArkadeCash bearer instrument: a private key plus the contract parameters needed to rebuild the payment contract it funds, encoded as a single bech32m string. Whoever holds the string controls the funds, so it can be handed over without exchanging an Arkade address first.

public class ArkadeCash : IDisposable
Inheritance
ArkadeCash
Implements
Inherited Members

Remarks

Encoding: arkadecash1... (mainnet) or tarkadecash1... (testnet/regtest), over a 69-byte payload of version (1 byte) + private key (32 bytes) + Arkade server public key (32 bytes) + BIP68 CSV sequence (4 bytes, big-endian). This matches the ArkadeCash format used by the TypeScript SDK.

Constructors

ArkadeCash(ECPrivKey, ECXOnlyPubKey, Sequence, string)

Creates an ArkadeCash instrument around an existing private key.

public ArkadeCash(ECPrivKey privKey, ECXOnlyPubKey serverPubkey, Sequence lockTime, string hrp = "arkadecash")

Parameters

privKey ECPrivKey

The private key that controls the funds. The instance takes ownership and disposes it.

serverPubkey ECXOnlyPubKey

The x-only public key of the Arkade server.

lockTime Sequence

The relative timelock (BIP68 sequence) of the unilateral exit path.

hrp string

The bech32m prefix: arkadecash (default) or tarkadecash.

Exceptions

ArgumentException

The prefix is neither arkadecash nor tarkadecash.

Properties

Hrp

The human-readable prefix this instrument encodes with: arkadecash or tarkadecash.

public string Hrp { get; }

Property Value

string

LockTime

The relative timelock (BIP68 sequence) of the contract's unilateral exit path.

public Sequence LockTime { get; }

Property Value

Sequence

PrivKey

The private key carried by the instrument; spending its VTXOs requires nothing else.

public ECPrivKey PrivKey { get; }

Property Value

ECPrivKey

Pubkey

The x-only public key derived from PrivKey, used as the owner key of the contract.

public ECXOnlyPubKey Pubkey { get; }

Property Value

ECXOnlyPubKey

ServerPubkey

The x-only public key of the Arkade server co-signing the contract.

public ECXOnlyPubKey ServerPubkey { get; }

Property Value

ECXOnlyPubKey

Methods

Dispose()

Disposes the private key held by this instrument.

public void Dispose()

Generate(ECXOnlyPubKey, Sequence, string?)

Generates an ArkadeCash instrument with a freshly generated random private key.

public static ArkadeCash Generate(ECXOnlyPubKey serverPubkey, Sequence locktime, string? hrp = null)

Parameters

serverPubkey ECXOnlyPubKey

The x-only public key of the Arkade server.

locktime Sequence

The relative timelock (BIP68 sequence) of the unilateral exit path.

hrp string

The bech32m prefix; defaults to arkadecash when omitted.

Returns

ArkadeCash

A new instrument holding the generated key.

Parse(string)

Decodes an ArkadeCash string produced by ToString().

public static ArkadeCash Parse(string encoded)

Parameters

encoded string

The bech32m string; surrounding whitespace and casing are normalised.

Returns

ArkadeCash

The decoded instrument.

Exceptions

FormatException

The prefix, checksum, payload length, or version is invalid.

ToString()

Encodes the instrument as its bech32m string, e.g. arkadecash1....

public override string ToString()

Returns

string

The encoded ArkadeCash string. It carries the private key — treat it as a secret.

TryParse(string, out ArkadeCash?)

Attempts to decode an ArkadeCash string, without throwing on malformed input.

public static bool TryParse(string encoded, out ArkadeCash? arkadeCash)

Parameters

encoded string

The bech32m string to decode.

arkadeCash ArkadeCash

The decoded instrument, or null when decoding fails.

Returns

bool

true when the string decoded successfully; otherwise false.