Entry

  1. Attributes
  2. Operations

An entry defines a change in the dataset. The ordered list of entries form the log. Entries are immutable.

Each entry defines a change for an element in the dataset by recording the time the change was added to the log, the numerical order in the log, the key to identify the element the change is for and the reference to the data for that element, the blob.

type Entry =
  { number: Integer
  , timestamp: Timestamp
  , key: ID
  , blob: Hash
  }

Attributes

Number

The entry number is unique and defines the position of the entry within the log.

The range MUST be the positive numbers, that is the natural numbers excluding 0.

Key

  • Type: ID.

The key identifies the element of the dataset which the entry refers to.

Timestamp

The time when the entry was added to the log. This means that the timestamp is no guarantee of entry order, the entry number is.

Blob references

The blob hash the entry links to.

Operations

Hash

The identity of an entry computed from its content. It is used for audit as the Merkle tree leaves.

The function takes an entry and a hashing algorithm and returns a Hash datatype.

hash : Entry -> HashingAlgorithm -> Hash

When this algorithm operates on hashes (e.g. tag, concatenate) it is done on bytes, not the hexadecimal string representation.

  1. Let hashList be an empty list.
  2. Let number be the string representation of the entry number.
  3. Let key be the string representation of the entry key.
  4. Let timestamp be the string representation of the entry timestamp.
  5. Let blob be the list of bytes of the blob hash.
  6. Apply the hashValue function to number tagged with 0x69 (Integer). And append the result to hashList.
  7. Apply the hashValue function to key tagged with 0x75 (String). And append the result to hashList.
  8. Apply the hashValue function to timestamp tagged with 0x74 (Timestamp). And append the result to hashList.
  9. Apply the hashValue function to blob tagged with 0x72 (Hash). And append the result to hashList.
  10. Concatenate the elements of hashList in order (i.e. [numberHash, keyHash, timestampHash, blobHash]), tag it with 0x6C (List) and hash the result.

The tagging operation prepends a byte identifying the type to a list of bytes.

Tags:

  • Integer: 0x69
  • List: 0x6C
  • Hash: 0x72
  • Set: 0x73
  • Timestamp: 0x74
  • String: 0x75

For example, the following entry:

Entry
  { number = 6
  , key = ID "GB"
  , timestamp = Timestamp 2016 4 5 13 23 5 Utc
  , blob = Hash "12206b18693874513ba13da54d61aafa7cad0c8f5573f3431d6f1c04b07ddb27d6bb"
  }

Has the following hash:

Hash "122002f78a0faf50516849602399b6be7b1a0775fccc3ea0318fda9c6fcf7a4000cb"

The entry hash algorithm is based on the objecthash algorithm.

© Crown copyright released under the Open Government Licence.