OK - hopefully have my head on straight with this (but bear with me, it's been a long day!).
Tachikoma, the way you've laid it out is great - I had a slightly different approach (same endgame) in mind when I brought it up - for clarity I've just gone ahead and drawn up the sort of spec simplification I had in mind (kind of more focused on rules than methodology) - can you have a look and I'd appreciate your thoughts?
Regarding the specific levels/order of testing is it necessary to lock in the rule evaluation method/order? I think the approach can be left up to the implementation providing the rules are clear enough - if we need to specify a methodology for interpreting the rules then the rules are not clear enough.
OriginalThe transaction data is encoded into said fake Bitcoin address which is then used as an output in a single Bitcoin transaction satisfying the following requirements:
* Has a single or the largest input signed by the sending address
* Has an output for the recipient address (the 'reference' address)
* Has an output for the exodus address
* Has an output for the encoded fake address (the 'data' address)
* Has all output values above the 'dust' threshold (currently 0.00005430 BTC) and preferable be equal.
* Additional outputs are permitted for the remainder of the input (the 'change' address)
The following conditions must also be satisfied for the transaction to be considered decode-able:
* The reference address sequence number must be the data address sequence number + 1
* Ideally, all outputs should be the same (except the change). In fringe cases where the change output value is equal to the other output values the change address can be identified by sequence number, which must not equal or be +/-1 of the sequence number for either the reference address or the data address
* A last resort 'peek and decode' method may be used to identify the data packet in the event of ambiguity following the above rules. This involves decoding each packet and looking for the correct bytes for a simple send (the majority of bytes in a Class A simple send do not change). These byte checks are defined as:
+ Bytes two to eight must equal 00
+ Byte nine must equal 01 or 02
* Should there still be packet ambiguity or 'peek and decode' reveals more than one packet (simple sends are always one packet) the transaction is considered invalid.
NOTE: The sequence number for a given address is defined as a 1 -byte integer stored as the first byte of each 'packet'. Sequence numbers are continuous with 0 following 255 (256=0, 255+1=0).
RevisedThe transaction data is encoded into said fake Bitcoin address which is then used as an output in a single Bitcoin transaction satisfying the following requirements:
* Has a single or the largest input signed by the sending address
* Has an output for the recipient address (the 'reference' address)
* Has an output for the exodus address
* Has an output for the encoded fake address (the 'data' address)
* Has all output values above the 'dust' threshold (currently 0.00005430 BTC)
* Has exactly two outputs with a value equal to the Exodus output and/or has exactly one output with a sequence number +1 of the data address for reference output identification
* Additional outputs are permitted for the remainder of the input (the 'change' address)
NOTE: The sequence number for a given address is defined as a 1 -byte integer stored as the first byte of each 'packet'. Sequence numbers are continuous with 0 following 255 (256=0, 255+1=0).
I also took out the byte range stuff too as it seemed a little unnecessary - if the transaction doesn't have a data address that can be decoded it doesn't satisfy 'Has an output for the encoded fake address (the 'data' address)' and thus is already explicitly invalidated by said rule. What constitutes a valid data address is already defined elsewhere (under the simple send section).
Can you think of any cases my alternative revision doesn't cover? Essentially it's anything P&Dable = valid.
I realize this is a different approach to the simplification - as you can see I've been quite aggressive in removing the ambiguity that currently surrounds Class A (so that a transaction either satisfies the rules or it doesn't, no interpretation). Please let me know your thoughts on this and whether you still prefer to document with decoding methodology (eg levels/order etc) - as always happy to discuss
I'll be excited to have Class A done & dusted!
Thanks
Zathras
EDIT just for clarity - in practice I would still just use P&D for all Class A decoding as that is the (imo) simplest implementation methodology for testing against "Has exactly two outputs with a value equal to the Exodus output and/or has exactly one output with a sequence number +1 of the data address for reference output identification".
Hope the post makes sense!