<oembed><type>rich</type><version>1.0</version><title>Achow101 [ARCHIVE] wrote</title><author_name>Achow101 [ARCHIVE] (npub1wh…d26cj)</author_name><author_url>https://yabu.me/npub1wh7lmdsh2r0ygnp39pk7k5a7mll5x5w44pwn6ekvdvmwjhazr5rqxd26cj</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>📅 Original date posted:2018-06-26&#xA;📝 Original message:Hi,&#xA;&#xA;On June 26, 2018 8:33 AM, matejcik via bitcoin-dev &lt;bitcoin-dev at lists.linuxfoundation.org&gt; wrote:&#xA;&#xA;&gt; ​​&#xA;&gt; &#xA;&gt; hello,&#xA;&gt; &#xA;&gt; in general, I agree with my colleague Tomas, the proposed changes are&#xA;&gt; &#xA;&gt; good and achieve the most important things that we wanted. We&#39;ll review&#xA;&gt; &#xA;&gt; the proposal in more detail later.&#xA;&gt; &#xA;&gt; For now a couple minor things I have run into:&#xA;&gt; &#xA;&gt; -   valid test vector 2 (&#34;one P2PKH input and one P2SH-P2WPKH input&#34;)&#xA;&gt;     &#xA;&gt;     seems broken, at least its hex version; a delimiter seems to be missing,&#xA;&gt;     &#xA;&gt;     misplaced or corrupted&#xA;&#xA;Fixed&#xA;&#xA;&gt;     &#xA;&gt; -   at least the first signing vector is not updated, but you probably&#xA;&gt;     &#xA;&gt;     know that&#xA;&#xA;I updated all of the tests yesterday so they should be correct now. I will be adding more tests&#xA;this week.&#xA;&#xA;&gt;     &#xA;&gt; -   BIP32 derivation fields don&#39;t specify size of the &#34;master public key&#34;,&#xA;&gt;     &#xA;&gt;     which would make it un-parsable :)&#xA;&#xA;Oops, that&#39;s actually supposed to be master key fingerprint, not master public key. I have updated&#xA;the BIP to reflect this.&#xA;&#xA;&gt;     &#xA;&gt; -   &#34;Transaction format is specified as follows&#34; and its table need to be&#xA;&gt;     &#xA;&gt;     updated.&#xA;&#xA;Done.&#xA;&#xA;&gt;     &#xA;&gt;     I&#39;m still going to argue against the key-value model though.&#xA;&gt;     &#xA;&gt;     It&#39;s true that this is not significant in terms of space. But I&#39;m more&#xA;&gt;     &#xA;&gt;     concerned about human readability, i.e., confusing future implementers.&#xA;&gt;     &#xA;&gt;     At this point, the key-value model is there &#34;for historical reasons&#34;,&#xA;&gt;     &#xA;&gt;     except these aren&#39;t valid even before finalizing the format. The&#xA;&gt;     &#xA;&gt;     original rationale for using key-values seems to be gone (no key-based&#xA;&gt;     &#xA;&gt;     lookups are necessary). As for combining and deduplication, whether key&#xA;&gt;     &#xA;&gt;     data is present or not is now purely a stand-in for a &#34;repeatable&#34; flag.&#xA;&gt;     &#xA;&gt;     We could just as easily say, e.g., that the high bit of &#34;type&#34; specifies&#xA;&gt;     &#xA;&gt;     whether this record can be repeated.&#xA;&gt;     &#xA;&gt;     (Moreover, as I wrote previously, the Combiner seems like a weirdly&#xA;&gt;     &#xA;&gt;     placed role. I still don&#39;t see its significance and why is it important&#xA;&gt;     &#xA;&gt;     to correctly combine PSBTs by agents that don&#39;t understand them. If you&#xA;&gt;     &#xA;&gt;     have a usecase in mind, please explain.&#xA;&#xA;There is a diagram in the BIP that explains this. The combiner&#39;s job is to combine two PSBTs that&#xA;are for the same transaction but contain different data such as signatures. It is easier to implement&#xA;a combiner that does not need to understand the types at all, and such combiners are forwards compatible,&#xA;so new types do not require new combiner implementations.&#xA;&#xA;&gt;     &#xA;&gt;     ISTM a Combiner could just as well combine based on whole-record&#xA;&gt;     &#xA;&gt;     uniqueness, and leave the duplicate detection to the Finalizer. In case&#xA;&gt;     &#xA;&gt;     the incoming PSBTs have incompatible unique fields, the Combiner would&#xA;&gt;     &#xA;&gt;     have to fail anyway, so the Finalizer might as well do it. Perhaps it&#xA;&gt;     &#xA;&gt;     would be good to leave out the Combiner role entirely?)&#xA;&#xA;A transaction that contains duplicate keys would be completely invalid. Furthermore, in the set of typed&#xA;records model, having more than one redeemScript and witnessScript should be invalid, so a combiner&#xA;would still need to understand what types are in order to avoid this situation. Otherwise it would produce&#xA;an invalid PSBT.&#xA;&#xA;I also dislike the idea of having type specific things like &#34;only one redeemScript&#34; where a more generic&#xA;thing would work.&#xA;&#xA;&gt;     &#xA;&gt;     There&#39;s two remaining types where key data is used: BIP32 derivations&#xA;&gt;     &#xA;&gt;     and partial signatures. In case of BIP32 derivation, the key data is&#xA;&gt;     &#xA;&gt;     redundant ( pubkey = derive(value) ), so I&#39;d argue we should leave that&#xA;&gt;     &#xA;&gt;     out and save space. &#xA;&#xA;I think it is still necessary to include the pubkey as not all signers who can sign for a given pubkey may&#xA;know the derivation path. For example, if a privkey is imported into a wallet, that wallet does not necessarily&#xA;know the master key fingerprint for the privkey nor would it necessarily have the master key itself in&#xA;order to derive the privkey. But it still has the privkey and can still sign for it.&#xA;&#xA;&gt;     &#xA;&gt;     Re breaking change, we are proposing breaking changes anyway, existing&#xA;&gt;     &#xA;&gt;     code will need to be touched, and given that this is a hand-parsed&#xA;&gt;     &#xA;&gt;     format, changing `parse_keyvalue` to `parse_record` seems like a small&#xA;&gt;     &#xA;&gt;     matter?&#xA;&#xA;The point is to not make it difficult for existing implementations to change. Mostly what has been done now is just&#xA;moving things around, not an entire format change itself. Changing to a set of typed records model require more&#xA;changes and is a complete restructuring of the format, not just moving things around.&#xA;&#xA;Additionally, I think that the current model is fairly easy to hand parse. I don&#39;t think a record set model would make&#xA;it easier to follow. Furthermore, moving to Protobuf would make it harder to hand parse as varints are slightly more&#xA;confusing in protobuf than with Compact size uints. And with the key-value model, you don&#39;t need to know the types&#xA;to know whether something is valid. You don&#39;t need to interpret any data.&#xA;&#xA;&#xA;&#xA;Andrew</html></oembed>