Willow Drop Format

Status: Proposal

An ornamental drawing of various characters transporting and discovering cardboard boxes. Dalton is looking at a map, unaware of the cardboard boxes behind the bush next to them. Alfie is transporting two cardboard boxes on the back of a bicycle. Betty is preparing to launch a cardboard box with a catapult, and seems rather pleased about it.You really could transport Willow data using any of the means above.The Confidential Sync protocol presents a way for two peers with an established connection to efficiently exchange data. But running the necessary infrastructure to establish such connections (e.g. a STUN server, distributed hash table, or relay servers) is a non-trivial task, limiting who can operate them.

The Willow Drop Format presents a way for peers to transmit data to each other asynchronously and via completely user-improvised channels.

Instead of statefully coordinating which data to exchange, the Drop Format encodes drops, arbitrary sets of Entries and Payloads compiled into a single bytestring. A drop can then be treated as a kind of static store which can be joined with any other store as per the Willow Data Model.

A diagram of an ad-hoc network. An old computer connects to a newer desktop computer via a USB key. The newer desktop computer connects to a smartphone via email. The smartphone connects to another smartphone via a messaging app. And that smartphone connects to a laptop via a local wireless connection.An example flow of Willow data travelling from device to device, first via USB key, then email, then a messaging app, then local wireless.Drops are then shared via informal ad-hoc infrastructure:

  • USB keys
  • SD cards
  • CDs
  • Email attachments
  • Instant messages
  • Torrents
  • Or whatever means users have at hand.

Drops will often undoubtedly contain stale data that users are already aware of or no longer need. But what the Drop Format gives up in efficiency it more than makes up for in simplicity and flexibility. It is simple to implement, and works with the infrastructure users already have.

Parameters

See Drop Format Parameters for a default recommendation of parameters.In order to use the drop format, one must first specify a full suite of instantiations of the parameters of the core Willow data model. The hash_payload parameter of the data model must be a member of the Bab family of hash functions. In addition to this, the drop format requires the following:

Format

A drop is a collection of entries, together with verifiable subslices of their payloads. The payload slice verification relies on Bab; drops store the baseline verifiable slice streams of payload slices.

Let entries a sequence of pairs of a PossiblyAuthorisedEntries and a sequence of non-overlapping slices of payload chunks with stricly increasing start offsets. The PossiblyAuthorisedEntries must all come from a single namespace with NamespaceId namespace. The Sideloading Protocol then defines how to encode this sequence as a single bytestring (the corresponding drop).

Let be the result of default_entry(default_namespace_id, default_subspace_id, default_payload_digest), and let be default_authorisation_token.

Then, the actual drop is the concatenation of the following:

A tag of width for the length (number) of entries, followed by the corresponding compact U64 encoding.
The code in encode_namespace_id for namespace.
For every -th pair ((, ), ) of entries , a concatenation of the following form:
BitsBig-Endian Bitfield
01 iff .subspace_id != .subspace_id
11 if .timestamp > .timestamp, 0 if .timestamp < .timestamp, arbitrary if .timestamp == .timestamp.
2, 3A tag of width for abs(.timestamp - .timestamp).
4, 5A tag of width for .payload_length.
6, 7Two bits, selected as follows:
  • If is empty, these two bits may be set to 00.
  • If consists of a single slice, and that slice constitutes the full payload of , these two bits may be set to 01.
  • If consists of a single slice, and that slice starts at chunk index zero, these two bits may be set to 10.
  • These two bits may always be set to 11.
Any relative code in EncodePathRelativePath for .path, relative to .path.
The corresponding compact U64 encoding for bits 2, 3.
The corresponding compact U64 encoding for bits 4, 5.
Any code in encode_payload_digest for .payload_digest.
Any relative code in EncodeAuthorisationToken for , relative to the pair of (, ) and .

Transport

Once created, a drop can be transported by whatever means a single bytestring can be transferred, so that the decoded entries can be ingested by its recipients.

We highly recommend encrypting drops for transport.

A Sideloading emblem: A stylised drawing of tufty grass growing in between the cracks of paving stones, next to a graffiti-styled rendition of the word "Sideload".