<oembed><type>rich</type><version>1.0</version><title>matejcik [ARCHIVE] wrote</title><author_name>matejcik [ARCHIVE] (npub18g…sgac3)</author_name><author_url>https://yabu.me/npub18g04tf4qudcsna6qfcrm55s39axx3ymrunr65gxen4rctm0zv24sasgac3</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>📅 Original date posted:2018-06-19&#xA;📝 Original message:hello,&#xA;this is our second e-mail with replies to Pieter&#39;s suggestions.&#xA;&#xA;On 16.6.2018 01:34, pieter.wuille at gmail.com (Pieter Wuille) wrote:&#xA;&gt; * Key-value map model or set model.&#xA;&gt; &#xA;&gt; This was suggested in this thread:&#xA;&gt; https://twitter.com/matejcik/status/1002618633472892929&#xA;&gt; &#xA;&gt; The motivation behind using a key-value model rather than a simple&#xA;&gt; list of records was that PSBTs can be duplicated (given to multiple&#xA;&gt; people for signing, for example), and merged back together after&#xA;&gt; signing. With a generic key-value model, any implementation can remove&#xA;&gt; the duplication even if they don&#39;t understand fields that may have&#xA;&gt; been added in future extensions.&#xA;&gt; &#xA;&gt; However, almost the same can be accomplished by using the simpler set&#xA;&gt; model (the file consists of a set of records, with no duplication&#xA;&gt; allowed). This would mean that it would technically be legal to have&#xA;&gt; two partial signatures with the same key for the same input, if a&#xA;&gt; non-deterministic signer is used.&#xA;&#xA;Strongly agree with this.&#xA;&#xA;Just to note, we should probably use varint for the &lt;type&gt; field - this&#xA;allows us, e.g., to create “namespaces” for future extensions by using&#xA;one byte as namespace identifier and one as field identifier.&#xA;&#xA;&gt; &#xA;&gt; On the other hand, this means that certain data currently encoded&#xA;&gt; inside keys can be dropped, reducing the PSBT size. This is&#xA;&gt; particularly true for redeemscripts and witnessscripts, as they can&#xA;&gt; just be computed by the client when deserializing. The two types could&#xA;&gt; even be merged into just &#34;scripts&#34; records - as they don&#39;t need to be&#xA;&gt; separated based on the way they&#39;re looked up (Hash160 for P2SH, SHA256&#xA;&gt; for P2WSH). The same could be done for the BIP32 derivation paths,&#xA;&gt; though this may be expensive, as the client would need to derive all&#xA;&gt; keys before being able to figure out which one(s) it needs.&#xA;&#xA;It could be nice if the output scripts records would be ordered the same&#xA;as their corresponding outputs. But what if the Creator doesn’t want to&#xA;include a script for an output? Perhaps the Script record should have a&#xA;&lt;vout&gt; field to match it to the appropriate output.&#xA;&#xA;As for input scripts, we suggest that they are per-input and not&#xA;included in the global record, see the other thread.&#xA;&#xA;&gt; &#xA;&gt; One exception is the &#34;transaction&#34; record, which needs to be unique.&#xA;&gt; That can either be done by adding an exception (&#34;there can only be one&#xA;&gt; transaction record&#34;), or by encoding it separately outside the normal&#xA;&gt; records (that may also be useful to make it clear that it is always&#xA;&gt; required).&#xA;&#xA;This seems to be the case for some fields already - i.e., an input field&#xA;must have exactly one of Non-witness UTXO or Witness Output. So “adding&#xA;an exception” is probably just a matter of language?&#xA;&#xA;&#xA;We’d also like to note that the “number of inputs” field should be&#xA;mandatory - and as such, possibly also a candidate for outside-record field.&#xA;&#xA;&gt; &#xA;&gt; * Ability for Combiners to verify two PSBT are for the same transaction&#xA;&gt; &#xA;&gt; Clearly two PSBTs for incompatible transactions cannot be combined,&#xA;&gt; and this should not be allowed.&#xA;&gt; &#xA;&gt; It may be easier to enforce this if the &#34;transaction&#34; record inside a&#xA;&gt; PSBT was required to be in a canonical form, meaning with empty&#xA;&gt; scriptSigs and witnesses. In order to do so, there could be per-input&#xA;&gt; records for &#34;finalized scriptSig&#34; and &#34;finalized witness&#34;. Actually&#xA;&gt; placing those inside the transaction itself would only be allowed when&#xA;&gt; all inputs are finalized.&#xA;&#xA;Agreed! Also increases clarity, which is desired.&#xA;&#xA;&gt; * Derivation from xpub or fingerprint&#xA;&gt; &#xA;&gt; For BIP32 derivation paths, the spec currently only encodes the 32-bit&#xA;&gt; fingerprint of the parent or master xpub. When the Signer only has a&#xA;&gt; single xprv from which everything is derived, this is obviously&#xA;&gt; sufficient. When there are many xprv, or when they&#39;re not available&#xA;&gt; indexed by fingerprint, this may be less convenient for the signer.&#xA;&gt; Furthermore, it violates the &#34;PSBT contains all information necessary&#xA;&gt; for signing, excluding private keys&#34; idea - at least if we don&#39;t treat&#xA;&gt; the chaincode as part of the private key.&#xA;&gt; &#xA;&gt; For that reason I would suggest that the derivation paths include the&#xA;&gt; full public key and chaincode of the parent or master things are&#xA;&gt; derived from. This does mean that the Creator needs to know the full&#xA;&gt; xpub which things are derived from, rather than just its fingerprint.&#xA;&#xA;&#xA;We don’t understand the rationale for this idea. Do you see a scenario&#xA;where an index on master fingerprint is not available but index by xpubs&#xA;is? In our envisioned use cases at least, indexing private keys by xpubs&#xA;(as opposed to deriving from a BIP32 path) makes no sense.&#xA;&#xA;Maybe this folds into the proposal for generic derivation below, or&#xA;something like implementation-specific derivation methods?&#xA;&#xA;best regards&#xA;&#xA;Jan Matejek&#xA;Tomas Susanka&#xA;&#xA;-------------- next part --------------&#xA;A non-text attachment was scrubbed...&#xA;Name: signature.asc&#xA;Type: application/pgp-signature&#xA;Size: 819 bytes&#xA;Desc: OpenPGP digital signature&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20180619/70447694/attachment-0001.sig&gt;</html></oembed>