|
|
BSP is an application layer data synchronisation protocol for delay-tolerant networks. It can operate over any transport that can deliver a simplex stream of bytes from a sender to a recipient on a best-effort basis, meaning that streams may be delayed, lost, reordered or duplicated by the transport. BSP does not ensure the confidentiality, authenticity or integrity of streams; that is the responsibility of a transport layer security protocol such as [BTP](BTP).
|
|
|
|
|
|
BSP synchronises data between two devices referred to as the local and remote peers. The data to be synchronised consists of messages, which are organised into channels. From BSP's point of view, a message is simply a sequence of bytes and a channel is simply a set of messages. A message created by the local peer is called a local message, while a message synchronised from the remote peer is called a remote message.
|
|
|
BSP synchronises data between two devices referred to as the local and remote peers. The data to be synchronised consists of messages, which are organised into channels. From BSP's point of view, a message is simply a string of bytes and a channel is simply a set of messages. A message created by the local peer is called a local message, while a message synchronised from the remote peer is called a remote message.
|
|
|
|
|
|
Each channel on the local peer belongs to a client, which is responsible for deciding which messages are valid (the validity policy), which remote messages should be stored on the local peer (the storage policy), and which local messages should be shared with the remote peer (the sharing policy).
|
|
|
|
... | ... | @@ -45,13 +45,12 @@ The blocks form the leaves of a binary hash tree. Each parent node consists of t |
|
|
* `parent_node = left_child_hash || right_child_hash`
|
|
|
* `parent_hash = HASH("TREE", parent_node)`
|
|
|
|
|
|
The message's unique identifier is calculated by hashing a message header and the root hash. The message header consists of the channel identifier, a salt, a timestamp, the message length and the message type.
|
|
|
The message's unique identifier is calculated by hashing a message header and the root hash. The message header consists of the channel identifier, a timestamp, the message length and the message type.
|
|
|
|
|
|
* `salt = R(HASH_LEN)`
|
|
|
* `message_header = channel_id || salt || timestamp || message_length || message_type`
|
|
|
* `message_header = channel_id || timestamp || message_length || message_type`
|
|
|
* `message_id = HASH("MESSAGE_ID", message_header, root_hash)`
|
|
|
|
|
|
The random salt prevents collisions between otherwise identical messages. The timestamp is a 64-bit integer representing seconds since the Unix epoch. (All integers in BSP are big-endian.) The message length is a 64-bit integer representing the length of the message in bytes. The message type is a single byte that is supplied by the client and is not interpreted by BSP.
|
|
|
The timestamp is a 64-bit integer representing seconds since the Unix epoch. (All integers in BSP are big-endian.) The message length is a 64-bit integer representing the length of the message in bytes. The message type is a single byte that is supplied by the client and is not interpreted by BSP.
|
|
|
|
|
|
Each block has a unique identifier, which is calculated by hashing the message header, a block header and the hash of the block itself. The block header consists of the block number and a list of hashes called the path.
|
|
|
|
... | ... | |