Chapter 02 · Foundations
Every VDXF object is the same four-part shape. The interesting part is that type means two different things depending on whether the registry recognises it.
FIGURE 2.1 · OrdinalVDXFObject and its key routes.
VDXFObject is the base class: it carries a vdxfkey and implements the
serialisation contract. OrdinalVDXFObject extends the idea for the wire format with an
explicit version, type, optional key, and a
data payload.
The type field is doing two jobs at once, and this is the first thing to get straight:
for recognised objects it is a reserved ordinal (AUTHENTICATION_REQUEST_VDXF_ORDINAL,
IDENTITY_UPDATE_REQUEST_VDXF_ORDINAL, …) that maps to a class via
OrdinalVDXFObjectOrdinalMap; for everything else it is one of three reserved marker
bytes saying "the key is an i-address", "the key is a text VDXF key name", or "the key is an
identity/currency FQN".
src/vdxf/keys.ts is a list of plain objects: vdxfid,
hash160result, qualifiedname, optional bounddata and
indexid. The qualifiedname is the human name
(veruspay.vrsc::invoice); the vdxfid is the i-address the daemon resolves
to; the hash160result is the 20-byte key that actually lands in the bytes.
export const VERUSPAY_INVOICE_VDXF_KEY = {
qualifiedname: { name: "veruspay.vrsc::invoice", namespace: "iAisVse…" },
vdxfid: "iEETy7La3FTN2Sd2hNRgepek5S8x8eeUeQ",
hash160result: "628efc28c2e2d40050e1a9de7a93e7ddf2aa0076",
}
Almost every class carries a flags field built from powers of two, with a
setFlags() method that derives the bits from the optional fields actually present, and
a family of hasX() predicates. Two consequences follow, and both matter when debugging:
src/vdxf/classes/ordinals/OrdinalVDXFObject.ts # version, type, key, data src/vdxf/classes/ordinals/OrdinalVDXFObjectOrdinalMap.ts src/vdxf/keys.ts # every VDXF key constant src/utils/types/SerializableEntityBase.ts # the toBuffer/fromBuffer contract