Skip to content

Module BSV::KVStore::Interpreter

Historian interpreter for KVStore PushDrop tokens.

Decodes a PushDrop locking script from the specified output, validates it has the expected field count (5 old format / 6 new format), and filters by ctx[:key] and ctx[:protocol_id].

Returns the value as a UTF-8 string, or nil for any non-match or error. Never raises.

Field layout (old format — 5 fields): [0] protocolID (JSON-encoded array) [1] key [2] value [3] controller [4] signature

Field layout (new format — 6 fields): [0] protocolID (JSON-encoded array) [1] key [2] value [3] controller [4] tags [5] signature

Constants

CONTROLLER

Not documented.

KEY

Not documented.

KV_PROTOCOL_FIELDS_NEW

Not documented.

KV_PROTOCOL_FIELDS_OLD

Not documented.

PROTOCOL_ID

Not documented.

SIGNATURE_NEW

Not documented.

SIGNATURE_OLD

Not documented.

TAGS_NEW

Not documented.

VALUE

Not documented.

Public Class Methods

call(tx, output_index, ctx)

Decode the KVStore token at output_index in tx.

Implements the Historian interpreter contract: +interpreter.call(tx, output_index, ctx)+ → String or nil. - @param tx [Transaction::Tx, nil] the transaction to inspect - @param output_index [Integer] index into +tx.outputs+ - @param ctx [Hash, nil] must contain +:key+ (String) and +:protocol_id+ (Array) - @return [String, nil] the decoded UTF-8 value, or nil on any mismatch/error