akwizgran created page: BSP

akwizgran
2015-03-18 11:35:48 +00:00
parent 3f6b0f5373
commit dced9ec49e

@@ -14,10 +14,10 @@ Each channel has a unique identifier hash_len bytes long. This identifier is sup
### Message format
Each message consists of one or more blocks. Each block is block_len bytes long, except the last, which may be shorter. The blocks form the leaves of a binary hash tree, and the root hash of the tree uniquely identifies the message.
Each message consists of one or more blocks. Each block is block_len bytes long, except the last, which may be shorter. The blocks form the leaves of a binary hash tree. Each internal node of the tree consists of the concatenated hashes of its children, and the hash of the root node uniquely identifies the message.
A message header is prepended to each node of the tree before hashing. The message header consists of the channel identifier, a timestamp indicating when the message was posted, the depth of the hash tree, and the message type.
The timestamp is a 64-bit big-endian integer representing seconds since the Unix epoch. The depth of the hash tree is an 8-bit integer. The message type is a single byte that is not interpreted by BSP; the application may use it to respond appropriately to partially synchronised messages. The total length of the message header is hash_len + 10 bytes.
Prepending the message header to each node before hashing ensures that all blocks with a given message identifer have consistent message headers; this simplifies the validation of blocks received from the remote peer.
Prepending the message header to each node before hashing ensures that all blocks with a given message identifer have consistent message headers; this simplifies the validation of blocks received from the remote peer.