<oembed><type>rich</type><version>1.0</version><author_name>npub1xg2m84malu0cfm4444r0kysx4rgk27e75aj6sz6538kw8fcz627qeadsv7</author_name><author_url>https://nostr.ae/npub1xg2m84malu0cfm4444r0kysx4rgk27e75aj6sz6538kw8fcz627qeadsv7</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2014-01-27&#xA;📝 Original message:As promised I&#39;d like to present my work done on leveraging the payment&#xA;protocol for face-to-face payments. The general assumption is that&#xA;individuals don&#39;t own X.509 certificates. Their devices may be only&#xA;badly connected to the internet or in some cases not at all. I&#39;ve&#xA;implemented a prototype on a branch of Bitcoin Wallet. It is using&#xA;bitcoinj 0.11 (not released).&#xA;&#xA;https://github.com/schildbach/bitcoin-wallet/commits/payment-protocol&#xA;&#xA;&#xA;TAP TO PAY&#xA;&#xA;First I looked at the NFC tap-to-pay usecase. The way it works as&#xA;currently rolled out: A BIP21 URL is published using an NDEF URI&#xA;message. The URL is supplemented by a Bluetooth MAC address that can be&#xA;connected in order to finish the payment. Once connected, a very simple&#xA;custom protocol transmits the signed transaction(s) in&#xA;bitcoin-serialized form to the payee, who replies with an ack or nack.&#xA;&#xA;The way I prototyped it to work in future: Instead of the BIP21 URL a&#xA;BIP70 payment request is published using an NDEF MIME message (mime-type&#xA;as per BIP71). The paymentUrl field can (and in the face-to-face case&#xA;should) contain a Bluetooth URL which contains the MAC address of the&#xA;payee. Because I could not find any standard for Bluetooth URLs, I made&#xA;up my own: &#34;bt:112233445566&#34; means MAC address 11:22:33:44:55:66. Once&#xA;connected, Payment message and PaymentACK reply are used to finish the&#xA;payment. Since Bluetooth sockets are streams, I had to use the delimited&#xA;variant of the protobufs for Payment and PaymentACK messages. This&#xA;prepends them with a VARINT containing the message length.&#xA;&#xA;All of the above should be easy to migrate. NFC implementations are&#xA;rare, and the current Bluetooth protocol is implemented only by Bitcoin&#xA;Wallet afaik. Fallbacks are provided where necessary.&#xA;&#xA;In future, I&#39;d like to add encryption to the Bluetooth connection, maybe&#xA;using SSL and some DH key exchange.&#xA;&#xA;&#xA;SCAN TO PAY&#xA;&#xA;For scan-to-pay, the current landscape looks different. I assume at&#xA;least 50% of Bitcoin transactions are initiated by a BIP21 URL encoded&#xA;into a QR-code. Nevertheless, I tried to encode a payment request into&#xA;the bitcoin URL. I used my existing work on encoding transactions into&#xA;QR-codes. Steps to encode:&#xA;&#xA;1. The payment request is protobuf-serialized. For a simple payment&#xA;request, this results in only ~50 bytes thanks to the efficiency of&#xA;protobuf.&#xA;2. The bytes are encoded using &#34;Base43&#34;, which is the same as&#xA;Base64/Base58, but its alphabet consists of the characters allowed in&#xA;so-called &#34;alphanumeric&#34; QR-codes, minus the characters not allowed in URLs.&#xA;3. The resulting string is prefixed by &#34;BITCOIN:&#34;&#xA;4. All of that goes into a QR-code, and because it only contains&#xA;&#34;alphanumeric&#34; characters, it will produce a very efficient code. For&#xA;simple payment requests, I could not notice any difference in scanning&#xA;difficulty.&#xA;&#xA;There are some limitations however:&#xA;&#xA;- Obviously such QR-encoded payment requests cannot grow in size as much&#xA;as using other media. In particular, I expect PKI signed requests are&#xA;out of question. However, in face to face payments the value of a sig&#xA;based on PKI is highly questionable, and the fact the sig cannot be&#xA;verified without TCP connectivity doesn&#39;t help. There should be some&#xA;headroom for multiple-output requests and moderately more complex&#xA;scripts though.&#xA;&#xA;- I chose to re-use the &#34;bitcoin:&#34; URL scheme, because it&#39;s already&#xA;whitelisted in web browsers, QR-code scanners and so on. In order to&#xA;differentiate &#34;payment requests URLs&#34; from BIP21 URLs, I test for&#xA;uri.startsWith(&#34;BITCOIN:&#34;) because you&#39;ll get letters in all-caps from&#xA;alphanumeric QR-codes. I will investigate into a better solution.&#xA;&#xA;- Due to wide deployment of BIP21 QR-codes, migration needs to happen in&#xA;distinct phases. Ability to parse &#34;payment protocol URLs&#34; comes first,&#xA;default to presenting them to users has to come (much) later.&#xA;&#xA;&#xA;CLICK TO PAY&#xA;&#xA;Finally this is the usecase the payment protocol was invented for and&#xA;it&#39;s not face-to-face. I don&#39;t have much to add, just one thing. As a&#xA;byproduct of the above, &#34;payment protocol URLs&#34; can be used for links&#xA;published on web pages as well. This might provide a nice replacement&#xA;for the imho rather ugly BIP72 specification once the payment protocol&#xA;is widely deployed.&#xA;&#xA;&#xA;Open for discussion.</html></oembed>