8636fb8c03
* changes receivedTime type to double * adds MUST for sorting based on Index |
||
---|---|---|
.. | ||
README.md |
README.md
slug | title | name | status | editor | contributors | ||
---|---|---|---|---|---|---|---|
13 | 13/WAKU2-STORE | Waku v2 Store | draft | Sanaz Taheri <sanaz@status.im> |
|
This specification explains the Waku WakuStore
protocol which enables querying of messages received through relay protocol and stored by other nodes. It also supports pagination for more efficient querying of historical messages.
Protocol identifier*: /vac/waku/store/2.0.0-beta2
Design Requirements
Nodes willing to provide storage service in WakuStore
protocol are required to be highly available and in specific have a high uptime to consistently receive and store network messages. The high uptime requirement makes sure that no message is missed out hence a complete and intact view of the message history is delivered to the querying nodes. Nevertheless, in case that storage provider nodes cannot afford high availability, the querying nodes may retrieve the historical messages from multiple sources to achieve a full and intact view of the past.
Security Consideration
The main security consideration to be taken into account while using WakuStore
is to notice that the querying nodes have to reveal their topics of interest to the queried nodes hence compromising their privacy.
Terminology
The term Personally identifiable information (PII) refers to any piece of data that can be used to uniquely identify a user. For example, the signature verification key, and the hash of one's static IP address are unique for each user and hence count as PII.
Adversarial Model
Any peer running the WakuStore
protocol i.e., both the querying node and the queried node are considered as an adversary. Furthermore, we consider the adversary as a passive entity that attempts to collect information from other peers to conduct an attack but it does so without violating protocol definitions and instructions. For example, under the passive adversarial model, no malicious node hides or lies about the history of messages as it is against the description of the WakuStore
protocol.
The following are not considered as part of the adversarial model:
- An adversary with a global view of all the peers and their connections.
- An adversary that can eavesdrop on communication links between arbitrary pairs of peers (unless the adversary is one end of the communication). In specific, the communication channels are assumed to be secure.
Wire Specification
Peers communicate with each other using a request / response API. The messages sent are Protobuf RPC messages. The followings are the specifications of the Protobuf messages.
Protobuf
message Index {
bytes digest = 1;
double receivedTime = 2;
}
message PagingInfo {
int64 pageSize = 1;
Index cursor = 2;
enum Direction {
FORWARD = 0;
BACKWARD = 1;
}
Direction direction = 3;
}
message HistoryQuery {
repeated string topics = 2;
optional PagingInfo pagingInfo = 3; // used for pagination
}
message HistoryResponse {
repeated WakuMessage messages = 2;
optional PagingInfo pagingInfo = 3; // used for pagination
}
message HistoryRPC {
string request_id = 1;
HistoryQuery query = 2;
HistoryResponse response = 3;
}
Index
To perform pagination, each WakuMessage
stored at a node running the WakuStore
protocol is associated with a unique Index
that encapsulates the following parts.
digest
: a sequence of bytes representing the hash of aWakuMessage
.receivedTime
: the UNIX time at which the waku message is received by the node running theWakuStore
protocol.
PagingInfo
PagingInfo
holds the information required for pagination. It consists of the following components.
pageSize
: A positive integer indicating the number of queriedWakuMessage
s in aHistoryQuery
(or retrievedWakuMessage
s in aHistoryResponse
).cursor
: holds theIndex
of aWakuMessage
.direction
: indicates the direction of paging which can be eitherFORWARD
orBACKWARD
.
HistoryQuery
RPC call to query historical messages.
- The
topics
field MUST indicate the list of topics to query. PagingInfo
holds the information required for pagination. ItspageSize
field indicates the number ofWakuMessage
s to be included in the correspondingHistoryResponse
. If thepageSize
is zero then no pagination is required. If thepageSize
exceeds a threshold then the threshold value shall be used instead. In the forward pagination request, themessages
field of theHistoryResponse
shall contain at maximum thepageSize
amount of waku messages whoseIndex
values are larger than the givencursor
(and vise versa for the backward pagination). Note that thecursor
of aHistoryQuery
may be empty (e.g., for the initial query), as such, and depending on whether thedirection
isBACKWARD
orFORWARD
the last or the firstpageSize
waku messages shall be returned, respectively. The queried node MUST sort theWakuMessage
s based on theirIndex
, where thereceivedTime
constitutes the most significant part and thedigest
comes next, and then perform pagination on the sorted result. As such, the retrieved page contains an ordered list ofWakuMessage
s from the oldest message to the most recent one.
HistoryResponse
RPC call to respond to a HistoryQuery call.
- The
messages
field MUST contain the messages found, these are [WakuMessage
] types as defined in the corresponding specification. PagingInfo
holds the paging information based on which the querying node can resume its further history queries. ThepageSize
indicates the number of returned waku messages (i.e., the number of messages included in themessages
field ofHistoryResponse
). Thedirection
is the same direction as in the correspondingHistoryQuery
. In the forward pagination, thecursor
holds theIndex
of the last message in theHistoryResponse
messages
(and the first message in the backward paging). The requester shall embed the returnedcursor
inside its nextHistoryQuery
to retrieve the next page of the waku messages. Thecursor
obtained from one node SHOULD NOT be used in a request to another node because the result MAY be different.
Future Work
- Anonymous query: This feature guarantees that nodes can anonymously query historical messages from other nodes (i.e., without disclosing the exact topics of waku messages they are interested in). As such, no adversary in the
WakuStore
protocol would be able to learn which peer is interested in which topics of waku message. The current version of theWakuStore
protocol does not provide anonymity for historical queries as the querying node needs to directly connect to another node in theWakuStore
protocol and explicitly disclose the topics of its interest to retrieve the corresponding messages. However, one can consider preserving anonymity through one of the following ways:- By hiding the source of the request i.e., anonymous communication. That is the querying node shall hide all its PII in its history request e.g., its IP address. This can happen by the utilization of a proxy server or by using Tor. Note that the current structure of historical requests does not embody any piece of PII, otherwise, such data fields must be treated carefully to achieve query anonymity. .
- By deploying secure 2-party computations in which the querying node obtains the historical messages of a certain topic whereas the queried node learns nothing about the query. Examples of such 2PC protocols are secure one-way Private Set Intersections (PSI). .
Changelog
Next
- Added the initial threat model and security analysis.
2.0.0-beta2
Released 2020-11-05
- Added pagination support.
2.0.0-beta1
Released 2020-10-06
- Initial draft version.
Copyright
Copyright and related rights waived via CC0.