encoding design goals
In the interests of clarifing the on-going discussion about the encoding and signing formats, I'd like to list the design goals and name them so that any proposal can easily list what goals it meets.
space-efficient
the encoding should be compact when sent or stored.
parse-efficient
in the interests of database queries, the format should be fast to read a few fields from thousands of encoded values.
cannonical
The same data should get exactly the same hash. It should not be possible to encode the same data in different ways.
backward-compatible
It should be possible to represent the current JSON based data in the proposed format, such that signatures in the current format can be verified by for example, applying a simple transformation to get JSON, and then calculating the hash and signature from that.
With respect to key order, the goal of backward-compatible
is not compatible with cannonical
, but with respect to floats it may be (will have to investigate V8's behavior in this regard)
well-specified
Ideally, we would use an official standard (such as CBOR) or (better) a subset. A possible compromise is to adapt such a standard to facilitate other goals.
easy to implement
If there are any alterations to a specified standard, it ought to be easy to implement, or checking it should be simple. This should synergize with well-specified.
current proposals
the currently suggested proposals and what goals they satisify.
null proposal
the JSON format currently in use.
backwards-compatible
(by definition) and easy-to-implement
(but only in javascript)
not easy-to-implement
in any other enviroment, nor does it meet the other goals.
It is mildly parse-efficient
in the sense that there are worse formats.
better binary encoding (transitional)
Targets backwards-compatible
(via a transformation to json) and parse-efficient
. pretty space-efficient
although that is not primary goal. expected to be equally easy-to-implement
in any enviroment.
The specification needs work. Something closer to a published standard but meeting the same goals would be better.
mvhsdt (cannonical)
thread a subset of CBOR with an additional optimization of space-efficient
for arrays.
Targets cannonical
, well-specified
and space-efficient
. This is not backwards compatible, so implementers would need to choose between either also supporting the null protocol or not supporting the current messages.
your proposal here?
would it be possible to have an encoding that could suitably start as a backward-compatible
design and then switch to a cannonical design (by sorting keys, etc) to a become a cannonical format?
what goals are important to people? for me the biggest priority is parse-efficient
and backward-compatible
. but I would be happy to design for a transition towards cannonical
. in this post
I would prefer to have something backwards compatible and take the network to the next level as a whole. Leaving the community behind would be a faliure.
@Aljoscha, you seem to be focused on cannonical
- how do you feel about a design that can transition from backward-compatible
to cannonical
. (As I see it, this would require an internal representation that preserves key order, but just for old messages)