<oembed><type>rich</type><version>1.0</version><author_name>npub17ty4mumkv43w8wtt0xsz2jypck0gvw0j8xrcg6tpea25z2nh7meqf4qgyd</author_name><author_url>https://nostr.ae/npub17ty4mumkv43w8wtt0xsz2jypck0gvw0j8xrcg6tpea25z2nh7meqf4qgyd</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2015-07-20&#xA;📝 Original message:Hey Thomas,&#xA;&#xA;Here are some thoughts on a third way we can tackle our BIP 70 usability&#xA;problem sans servers: by finding an upgrade to QR codes that give us more&#xA;space and then optimising the hell out of BIP70 to make it fit.&#xA;&#xA;*Better QR codes*&#xA;&#xA;Let&#39;s start with this paper, High Capacity Colored Two Dimensional Codes&#xA;&lt;http://proceedings2010.imcsit.org/pliks/79.pdf&gt;. It develops an upgrade to&#xA;standard QR codes that extend them with the use of colour. The resulting&#xA;codes have ~4x the capacity but similar levels of scanning robustness.&#xA;&#xA;This paper is also interesting: DualCodes&#xA;&lt;https://books.google.at/books?id=O5a6BQAAQBAJ&amp;pg=PA25&amp;lpg=PA25&amp;dq=%22DualCodes:+Backward+Compatible+Multi-layer+2D-Barcodes%22&amp;source=bl&amp;ots=ql_G8iyXXi&amp;sig=9-VwhFLbkfgh2Fi0tdM3AWOyajA&amp;hl=en&amp;sa=X&amp;redir_esc=y#v=onepage&amp;q=%22DualCodes%3A%20Backward%20Compatible%20Multi-layer%202D-Barcodes%22&amp;f=false&gt;&#xA;&#xA;It works by overlaying one QR code on top of another using shades of grey.&#xA;The resulting code is still scannable by older applications (backwards&#xA;compatibility!) but an enhanced reader can also extract the second code.&#xA;They explicitly mention digital signatures as a possible use case.&#xA;&#xA;In both cases the code does not appear to be available but the same&#xA;approach was used: extend libqrcode for creation and ZXing for decoding&#xA;(Android). We could ask the authors and see if they&#39;re willing to open&#xA;source their work.&#xA;&#xA;BIP 70 has the potential to add many features. But most of them, even the&#xA;extensions currently proposed only as ideas, can be expressed with&#xA;relatively few bytes.&#xA;&#xA;So with a 4x boost in capacity, or a 2x boost with backwards compat, what&#xA;could we do?&#xA;&#xA;*Optimised BIP70*&#xA;&#xA;If we define our own certificate formats and by implication our own CAs,&#xA;then we can easily make a certificate be 32 bytes for the ECC&#xA;signature+length of the asserted textual identity, e.g. email address.&#xA;&#xA;Can we go smaller? Arguably, yes. 32 bytes for a signature is for Really&#xA;Strong Security™ (a 256 bit curve), which gives 128 bits of security. If we&#xA;are willing to accept that a strong adversary could eventually forge a&#xA;certificate, we can drop down to a weaker curve, like a 128 bit cure with&#xA;64 bits of security. This is well within reach of, say, an academic team&#xA;but would still pose a significant hurdle for run of the mill payment&#xA;fraudsters. If these short CA keys expired frequently, like once a month,&#xA;the system could still be secure enough.&#xA;&#xA;As we are defining our own PKI we can make CA keys expire however&#xA;frequently we like, up to the expiry period of the BIP70 request itself.&#xA;Thus certificates that expire monthly is not an issue if the wallet has a&#xA;way to automatically refresh the certificate by using a longer term&#xA;stronger credential that it keeps around on disk.&#xA;&#xA;If we accept a single payment address i.e. no clever tricks around merge&#xA;avoidance, such a QR code could look like this:&#xA;&#xA;bitcoin:1aBcD1234....?x=serialized_payment_request&#xA;&#xA;However this requires text mode and wastes bytes at the front for the URI&#xA;type.&#xA;&#xA;If we&#39;re willing to accept QR codes that can&#39;t be read by a standalone app&#xA;and which requires an embedded reader, then we can just scrap the legacy&#xA;and serialise a binary BIP70 request directly into the QR code. Andreas&#39;&#xA;wallet, for example, can already handle this because it has an embedded QR&#xA;reader. I don&#39;t know what the situation on iOS is like.&#xA;&#xA;If we were to use the DualCodes system we could define the primary QR code&#xA;as being an unsigned payment request, and the second layer as being the&#xA;signature/pki data.&#xA;&#xA;*Getting response data back to the recipient*&#xA;&#xA;One reason to have a store/forward network is the &#34;forward&#34; part: we don&#39;t&#xA;only want to host a static PaymentRequest, but also receive a private&#xA;response e.g. for the memo field, or to implement the well known &#34;Stealth&#xA;Address&#34; / ECDH in the payment protocol proposals:&#xA;&#xA;https://medium.com/@octskyward/ecdh-in-the-payment-protocol-cb2f81962c1b&#xA;&#xA;Stealth addresses try and (ab)use the block chain as a store/forward layer&#xA;and break SPV in the process as well as wasting lots of resources. ECDH in&#xA;BIP70 avoids those issues but at the cost of requiring a separate&#xA;store-and-forward network with some notion of account privacy.&#xA;&#xA;These ideas come with another steep price: restoring a wallet from seed&#xA;words is no longer possible. You must have the extra random data to&#xA;calculate the private keys for money sent to you :(  If you lose the extra&#xA;data you lose the money. It can be fixed but only by having wallets&#xA;regularly sweep the sent money to keys derived from the BIP32 seed, meaning&#xA;privacy-hurting merging and extra traffic.&#xA;&#xA;I don&#39;t know of any way to solve this except by using some servers,&#xA;somewhere, that store the Payment messages for people: potentially for a&#xA;long period of time. If we have such servers, then having them host BIP70&#xA;requests is not a big extra requirement.&#xA;&#xA;I have imagined this being a p2p-ish network of HTTPS servers that accept&#xA;POSTs and GETs. But if we are thinking about alternatives, it could also be&#xA;a separate service of the existing Bitcoin P2P network. That&#39;s what&#xA;OP_RETURN (ab)use effectively does. But as these messages don&#39;t really have&#xA;to be kept forever, a different system could be used: Payment messages&#xA;could be broadcast along with their transactions and stored at every node,&#xA;waiting for download. But unlike regular transactions, they are not stored&#xA;forever in a block chain. They are just written to disk and eventually&#xA;erased, perhaps, ordered in a mempool like way where more fee attached ==&#xA;stored for longer, even though the nodes storing the data aren&#39;t actually&#xA;receiving the fee.&#xA;&#xA;A signature over the Payment metadata using the same output keys as the&#xA;transaction would bind them together for the purposes of broadcast, but&#xA;doesn&#39;t need to be stored after that.&#xA;&#xA;As the data storage is just a helpful service but not fundamentally&#xA;required, nodes could shard themselves by announcing in their addr messages&#xA;that they only store Payment metadata for e.g. the half which have a hash&#xA;starting with a one bit. And when outputs are seen being spent, the&#xA;associated Payment metadata can be erased too, as by then it&#39;s fair to&#xA;assume that the users wallet has downloaded the metadata and no longer&#xA;cares about it.&#xA;&#xA;Of course you have then all the regular DoS issues. But any P2P network&#xA;that stores data on the behalf of others has these.&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20150720/7b5c3cb0/attachment-0001.html&gt;</html></oembed>