Node specification
Requirements that a conformant node must meet. It does not depend on anything in client/.
This document gathers as requirements what has already been decided in network, the interface and conformance. The reason for each decision is in those documents; here it only says what a node must do. It also includes the protocol between nodes (section 6), because only nodes implement it.
1. What a conformant node is
Section titled “1. What a conformant node is”A conformant node:
- Meets all the functions of the base node (section 2).
- MAY enable a single complementary function: Mediator, Archive, Push or Relay (section 3). It MUST NOT enable more than one.
- MAY also be configured as an entity node (section 4), independently of the above.
- Implements the protocol between nodes (section 6) and the interface’s read routes.
2. Base node (Almena Node)
Section titled “2. Base node (Almena Node)”2.1. Identity
Section titled “2.1. Identity”- On its first start, the node MUST generate its key and its identity: a transferable KERI AID (network, 6.2).
- It MUST keep that identity between starts and MAY rotate its key without changing identifier.
- Its network identifier (PeerId) MUST be bound to its AID with a signed association, which it publishes in its entry (2.3). The PeerId is its position in the DHT: if it changes, the entry period starts again (network, 1.1.1 and 6.2).
- Recovery with the same identity files (network, 6.2.1): before operating, the node MUST check with several nodes that the last heartbeat of that identity is older than T (5.1). If it is active, it MUST NOT start. If a node sees more recent heartbeats signed with its own identity, it MUST stop. After a recovery it SHOULD rotate the key.
2.2. Clock
Section titled “2.2. Clock”- The node MUST synchronize its clock with NTS against at least 3 independent sources, with the goal of being within 100 ms of real time (network, 6.2.3).
- It MUST compute its drift with respect to the median of at least 5 neighbours, from the signed time of their heartbeats.
- If it drifts more than 1 s from that median, it MUST stop writing records and keeping custody until it is back within the margin for several consecutive heartbeats.
- It MUST treat the time of each new record as network, 6.2.3 says: within the margin, a normal record; earlier, a late record, accepted even if previous records are missing and marked as late in the acknowledgement; later, rejected. Copies from other custodians are not checked again.
2.3. Heartbeats and entry
Section titled “2.3. Heartbeats and entry”- An active node MUST emit a signed heartbeat with an increasing counter and its time every minute (6.1).
- It MUST publish its signed entry in the DHT (PeerId; disk and upload it contributes; address and read URL, one of each per relay if it is behind relays; complementary function if it has one and, for a Mediator Node, its DIDComm URL and its encryption key; entry date; and implementation and version for information only) and renew it before it expires after 24 h (network, 8.1).
- To leave, it SHOULD publish a signed withdrawal entry.
- During the entry period (7 days, counted from its custodians’ acknowledgements, network, 6.2.2) it works, but it is neither a custodian nor a mediator.
2.4. DHT and queries
Section titled “2.4. DHT and queries”- The node MUST take part in the DHT with libp2p and Kademlia, under the protocol identifier
/almena/kad/1.0.0(network, 1.1.1, registries, 2). It locates each piece of data by its hash or, if it changes, by its name (network, 1.2). - It MUST answer any network query: if it does not have the data, it locates it, fetches it and serves it. It MAY keep it in cache for at most 24 h.
- It MUST verify by hash and signature everything it receives, whether from a custodian, a cache or a wallet, and MUST reject whatever is not valid (conformance, layer 1).
2.5. Public read access (gateway)
Section titled “2.5. Public read access (gateway)”- The node MUST offer the read routes of the interface, 6, including
GET /1.0/info(interface, 8), and its only write route,POST /1.0/records, for publishing an activity record, directly or, if it is behind relays, at the address each relay gives it (network, 6.3). - A directly exposed node SHOULD use its own domain and TLS certificate.
- A search in the entity directory is resolved by an Archive Node; other nodes MUST forward it.
- Entities’ internal audit logs and mailboxes MUST NOT have a public route.
2.6. Custody
Section titled “2.6. Custody”- The node MUST accept the custody the network assigns to it: it is a custodian of a piece of data if it is among the k eligible nodes closest to its hash (for data that changes, to its name, such as the AID of a KEL, network, 1.2), skipping those in the same network or behind the same relay and the entity nodes of the entity itself. It computes eligibility only with public, signed data, like every node (network, 4).
- It MUST contribute the v2026-12-beta minimums: 10 GB of disk, 2 Mbps upload and 95 % availability (network, 5.1), and declare in its entry the disk and upload it contributes (2.3).
- If one of the k custodians of a piece of data has had no heartbeats for 1 hour and this node is the next closest, it MUST copy the data from the others (re-replication).
- It MUST answer storage challenges (6.5).
- Before storing a new activity record it MUST check its signature with the record key that the entity configuration gave when it was signed (not only the current one, network, 6.4.2), the continuity of its hash chain (a late record is accepted even if the previous one is missing, 2.2), its time (2.2) and the entity’s quota (2.8). If anything fails, it MUST reject it.
- For each KEL in its custody it MUST apply KERI’s first-seen rule: keep the first version it sees of each event and not replace it, except with a recovery rotation as KERI allows. If another version signed by the entity arrives for the same position, it MUST keep it too as proof of duplicity and serve it with the KEL (network, 1.2).
- It MUST NOT offer any operation to delete or modify records (network, 7.3). The only data it deletes is expired data, which it MUST NOT store, replicate or serve (network, 1.1.1).
- Validation by type. Before storing a piece of data it MUST check, besides its hash or its name, what its type requires, according to this table (registries, 6). If anything fails, it MUST reject it (6.4).
| Type | Signed by | It also checks |
|---|---|---|
| KEL | The entity’s managers | The KERI rules and first-seen (item 6). |
entity-config |
Sealed in the KEL with M of N | That its hash is the one in the seal (network, 6.4.2). |
directory-entry, form, vct-metadata, status-list, incident |
The entity’s issuing key, the one its configuration gave when it was signed | In data located by name, that the name matches whoever signs and that the version (in status-list, the iat) is higher than the one it keeps (network, 1.2). |
record |
The entity’s record key | Item 5. |
trust-credential |
Almena Trust | That its subject is the entity in the name. |
node-entry |
The node’s AID | That the name is that AID and that the version is higher than the one it keeps. |
evidence |
The node that generates it | That the signed messages it carries prove what it says (6.6). |
- Age and evidence of a node. For each node entry in its custody, it MUST keep its acknowledgement of the first version it received with that PeerId and the evidence about that node (6.6), and serve them with the entry (network, 6.2.2 and 8.1).
2.7. Monitoring between nodes
Section titled “2.7. Monitoring between nodes”- The node MUST monitor its neighbours for clock, availability, custody and declared function. It MUST generate signed evidence only when it has proof that anyone can check (6.6); what it only observes itself affects only its own choices and, if a custodian does not answer, makes it keep its own copy (conformance, layer 3).
- It MUST apply the same consequence rule as everyone else to that evidence: note it, and on repetition exclude from custody and mediation for a growing time (conformance, 3).
- Where it has a choice (relays, gateways), it SHOULD prefer nodes whose entry declares an implementation with a conformance credential, but MUST NOT reject the others (conformance, 3). Mediators are assigned at random and custodians are always the k closest.
2.8. Limits
Section titled “2.8. Limits”- It MUST apply the quotas per entity and day (publications and space) and reject whatever exceeds them with the
quota_exceedederror (network, 10). The values will be set with performance tests.
3. Complementary functions
Section titled “3. Complementary functions”3.1. Mediator Node
Section titled “3.1. Mediator Node”- It hosts DIDComm mailboxes of persons and entities and offers what is described in the interface, 2 to 5 and 7: Coordinate Mediation 3.0, Message Pickup 3.0, HTTPS (MUST) and WebSocket over TLS (SHOULD).
- It is transport only: it MUST NOT process, transform or keep messages outside the mailbox (network, 6.0).
- It MUST keep an uncollected message for at least 30 days and delete it when its receipt is confirmed.
- If it has a push URL for a mailbox, it SHOULD send an empty notice to that URL when a message arrives, at most one per minute and mailbox, signed in the style of VAPID (interface, 7). It MUST NOT know the operating system token.
- It SHOULD be exposed directly and not behind a relay.
- It MUST respect the cap on mailboxes per node (to be set with performance tests).
3.2. Archive Node
Section titled “3.2. Archive Node”- It keeps a full copy of everything public on the network that has not expired and builds the search index over it (network, 6).
- It MUST NOT store mailboxes or anything private.
- It MUST act as a watcher: it applies the first-seen rule of 2.6 to the KELs it keeps and, if it finds two different versions signed by the entity of the same KEL event or of the same position in a record chain, it keeps both as proof of duplicity and serves them (network, 7.3).
3.3. Push Node
Section titled “3.3. Push Node”- It notifies its publisher’s wallets when a mediator asks it to (interface, 7). Only it knows the operating system token.
3.4. Relay Node
Section titled “3.4. Relay Node”- It forwards the traffic between the nodes that cannot be exposed and their peers, without being able to read it: that traffic MUST be end-to-end encrypted (network, 6.3).
- It MUST have its own domain and TLS certificate, and forward to each node it serves, through the connection that node keeps open, the requests to
https://<its domain>/n/<node AID>/. - It states in its entry how many nodes it can serve.
- A node that depends on relays SHOULD use two, chosen at random and in different networks, and publishes in its entry the address that each one gives it (network, 8.1).
4. Entity node
Section titled “4. Entity node”An additional role of a node, authorized by the entity with M of N in its configuration (network, 6.4.2) and revocable. Every entity has at least one (network, 6.4).
- It collects the entity’s messages from its mailboxes, decrypts them and stores them in the entity store, which it may be itself or which it accesses. It is the only way into that store. None of it goes to the network.
- It MUST keep the entity’s keys and data separate from those it uses on the network.
- It generates and keeps the entity’s encryption, issuing and record keys, and the key with which it acts as a holder, in protected key storage (a hardware security module or equivalent). The encryption key is a hybrid key ML-KEM-768 + P-256; the signing keys SHOULD be composite ML-DSA-65 + ES256 (cryptography). It MUST NOT keep the managers’ rotation keys (key inventory).
- It writes the entity’s activity records and its internal audit log, and publishes the audit log anchor every 24 h and after each change in the KEL (network, 7).
- It stores the entity’s credentials when the entity acts as a holder (protocols).
- It offers the management interface to the entity console: it checks the console sign-in, opens sessions, prepares operations, asks the managers for their approvals and executes the operation when the threshold is reached (interface, 10).
- It only accepts being bound to an entity with its operator’s consent, given with a one-time binding code that it generates for its operator (interface, 10), and it MUST NOT be bound to more than one entity (network, 6.4).
- Several entity nodes (network, 6.4.1): each one has its own encryption key; a message is not deleted from the mailbox until it is in the entity store; how they coordinate among themselves is up to the implementation, over an end-to-end encrypted channel separate from the network.
- The network neither rewards nor penalizes a node for being an entity node.
5. Parameters
Section titled “5. Parameters”The v2026-12-beta values are in network, 5.1. They are provisional until the performance tests.
6. Protocol between nodes
Section titled “6. Protocol between nodes”Messages that nodes exchange. All of them are signed with the key of the node that emits them.
Format. Each message is JSON signed as JWS, like credentials and DIDComm, and travels over libp2p with a request–response protocol for each message type (6.1 to 6.6), whose identifier is /almena/node/1.0/<message> (registries, 2). If the performance tests call for it, it MAY later move to CBOR without changing the content.
Encryption. The channel between nodes SHOULD use a hybrid key agreement (ML-KEM-768 with X25519 or P-256). The channel between nodes of the same entity (6.7) carries private data, so it MUST be hybrid, with ML-KEM-768 and P-256 (cryptography, 3).
Common header. Every message is a JWS whose payload carries these fields:
| Field | Content |
|---|---|
type |
urn:almena:msg:node:1.0:<message> (registries, 2). It includes the version. |
id |
Unique identifier of the message. |
from |
AID of the emitting node, whose key signs the JWS. |
created_time |
Time of emission, in seconds since 1970 UTC. |
body |
The fields of each message, in the following table. |
| Message | Fields of body |
|---|---|
heartbeat (6.1) |
counter and time (UTC, with milliseconds, for clock monitoring). |
entry (6.2) |
entry: the node’s entry or its withdrawal, as published (network, 8.1). |
get (6.3) |
key: the hash or the name of the data. |
data (6.3) |
key, data (the data as published) and acks (the custodians’ acknowledgements, 6.4). |
publish (6.4) |
key and data. |
publish-ack (6.4) |
key and, for a record that arrives after the margin, late. The custodian is from. |
publish-reject (6.4) |
key and reason (an error code, interface, 9). |
challenge (6.5) |
key (the hash or name of the data, as in custody) and nonce (32 random bytes, in base64url). |
challenge-response (6.5) |
key, nonce, hash (the hash of the version of the data it keeps) and proof: the SHA-256 of the nonce followed by the bytes of that version, in base64url. |
evidence (6.6) |
node (AID of the node concerned), kind (custody or duplicity) and proof (the signed messages). |
6.1. Heartbeat
Section titled “6.1. Heartbeat”It contains the node’s AID, an increasing counter and its time. It serves for availability, identity recovery (2.1) and clock monitoring (2.2).
6.2. Entry and withdrawal
Section titled “6.2. Entry and withdrawal”The node directory entry (2.3) and the withdrawal entry. They are published in the DHT.
6.3. Query and retrieval
Section titled “6.3. Query and retrieval”Locating a piece of data in the DHT by its hash or its name (network, 1.2) and fetching it from a custodian or a cache.
6.4. Publication and custody
Section titled “6.4. Publication and custody”Delivery of a piece of data to its k custodians. Each custodian validates it (2.6) and responds with a signed acknowledgement or a rejection with its reason. The delivery carries the hash of the data and the data itself; the acknowledgement carries the custodian’s AID, the hash, the time and, for an activity record that arrives after the margin, the late mark (2.2). The custodian keeps its acknowledgement with the data and returns it whenever it serves the data; in re-replication, the acknowledgements travel with the copy.
6.5. Storage challenge
Section titled “6.5. Storage challenge”Once a day, a randomly chosen neighbour sends each custodian a random nonce for a piece of data in its custody. The custodian answers with the SHA-256 of the nonce followed by the data, which it can only compute if it keeps the whole piece of data. The neighbour gets the data by its hash from another custodian or a cache and computes the same value. If it matches, a signed acknowledgement is left. If it does not, the neighbour generates evidence (6.6), which anyone who has the data can check, and the data is re-replicated. If it does not respond, it is not proof for others: the neighbour keeps its own copy of the data (network, 9). For data that changes, the response states which version it used (its hash).
sequenceDiagram
%% kinds: V=base C=base N=base
participant V as Neighbour (random)
participant C as Custodian
participant N as Next closest node
Note over V,C: Once a day
V->>C: Challenge: data + random nonce
alt Correct answer
C->>V: SHA-256(nonce + data)
V->>V: Computes it with the data obtained from another custodian
V-->>C: Signed acknowledgement
else Wrong answer
V->>V: Generates signed evidence (6.6)
V->>N: Evidence
N->>N: Copies the data from the other custodians
else No answer
V->>V: Notes it (it is not proof for others)
V->>V: Keeps its own copy of the data
end
Note over C,N: Also if a custodian emits no heartbeats for 1 h6.6. Misbehaviour evidence
Section titled “6.6. Misbehaviour evidence”Proof about a specific node that anyone can check. There are two kinds: custody, a wrong signed response to a storage challenge (6.5), and duplicity, two signed messages from the node that contradict each other (for example, two different entries with the same version, or two heartbeats with the same counter). It carries the AID of the node concerned, the kind and the signed messages that prove it. It is published to the custodians of that node’s entry, which serve it with the entry (network, 8.1). A lack of response is not evidence (2.7).
6.7. Between nodes of the same entity
Section titled “6.7. Between nodes of the same entity”Their content is up to the implementation (section 4). They go through an end-to-end encrypted channel, separate from the network, with hybrid key agreement.
7. Security and privacy considerations
Section titled “7. Security and privacy considerations”- What a custodian sees: only public information, signed and without personal data. It can withhold it but not forge it; this is mitigated by the k copies, caches and Archive Nodes.
- What a mediator sees: encrypted messages, and when and how much each mailbox is used and from which IP address (interface, 11). That is why a person spreads their relationships among their 3 mediators.
- What a relay sees: whom the node communicates with and how much traffic it moves, and what is read through it, which is public. Never the content of the end-to-end encrypted traffic (network, 6.3).
- Entity node: it is the only one that has decrypted data, and only of its entity. Its security is the entity’s responsibility (P10).
- Multiple identities: they are curbed with the entry period, proven custody and network diversity (network, 6.2.2).
8. Open questions
Section titled “8. Open questions”None for now.