Table of Contents

Class MetadataList

Namespace
NArk.Core.Assets
Assembly
NArk.Core.dll

An ordered list of AssetMetadata entries with Merkle hash support. The Merkle tree uses BIP340 tagged hashes with tags "ArkadeAssetLeaf" and "ArkadeAssetBranch".

public class MetadataList
Inheritance
MetadataList
Inherited Members

Constructors

MetadataList(IReadOnlyList<AssetMetadata>)

public MetadataList(IReadOnlyList<AssetMetadata> items)

Parameters

items IReadOnlyList<AssetMetadata>

Fields

ArkBranchTag

public const string ArkBranchTag = "ArkadeAssetBranch"

Field Value

string

ArkLeafTag

public const string ArkLeafTag = "ArkadeAssetLeaf"

Field Value

string

ArkLeafVersion

public const byte ArkLeafVersion = 0

Field Value

byte

Properties

Items

public IReadOnlyList<AssetMetadata> Items { get; }

Property Value

IReadOnlyList<AssetMetadata>

Methods

FromBytes(byte[])

public static MetadataList FromBytes(byte[] buf)

Parameters

buf byte[]

Returns

MetadataList

FromReader(BufferReader)

public static MetadataList FromReader(BufferReader reader)

Parameters

reader BufferReader

Returns

MetadataList

FromString(string)

public static MetadataList FromString(string hex)

Parameters

hex string

Returns

MetadataList

Hash()

Computes the Merkle root hash of the metadata list using BIP340 tagged hashes. Leaf: taggedHash("ArkadeAssetLeaf", 0x00 || varslice(key) || varslice(value)) Branch: taggedHash("ArkadeAssetBranch", smaller || larger) where children are sorted lexicographically. Odd leaves are promoted unchanged.

public byte[] Hash()

Returns

byte[]

Serialize()

public byte[] Serialize()

Returns

byte[]

SerializeTo(BufferWriter)

public void SerializeTo(BufferWriter writer)

Parameters

writer BufferWriter

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.