<oembed><type>rich</type><version>1.0</version><author_name>npub1r375vdaydp5nnnytff6ee2kwzxak8whmwkmnkm6h67agr7dadfkqxn6ccq</author_name><author_url>https://nostr.ae/npub1r375vdaydp5nnnytff6ee2kwzxak8whmwkmnkm6h67agr7dadfkqxn6ccq</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2015-02-22&#xA;📝 Original message:Hello Jan,&#xA;&#xA;Regarding a few of your questions:&#xA;&#xA;Andreas and I had a number of private discussions regarding the &#xA;payment_url parameter. I had suggested a &#34;additional_payment_urls&#34; &#xA;repeated parameter, but he didn&#39;t seem to like that idea and I &#xA;personally am indifferent, so that is why we decided to just change &#xA;payment_url to a repeated field. The spec is simpler without the &#xA;&#34;additional_payment_urls&#34;, but the wallets have to be a little bit &#xA;smarter finding the right url they want to use in the list. It&#39;s maybe &#xA;not a bad idea for the wallet to try all payment_url mechanisms in &#xA;parallel. Should we add this as a recommendation to wallets in TBIP75?&#xA;&#xA;I had heard from Andreas a few weeks ago that the multiple r parameters &#xA;was not yet implemented. Maybe your interest can motivate him to do so!&#xA;&#xA;I actually also happen to be using nfcpy. I am having some reliability &#xA;issues as well with it. What exactly are your problems?&#xA;&#xA;I have seen your video before. I guess I&#39;m wondering how your prototype &#xA;works with bitpay and bluetooth. Doesn&#39;t bitpay sign the payment request &#xA;for you with an https based payment_url? If so, how do you add the &#xA;bluetooth payment_url while keeping their signature valid? In your video &#xA;it looks like the phone still has cellular and wifi reception (it is not &#xA;offline).&#xA;&#xA;You mention workflow options 1,2,3. You forgot to mention that options &#xA;1,2 are not backwards compatible with older wallets.&#xA;&#xA;Regarding the NFC data formats. I would like to clarify that the wallets &#xA;are having those events dispatched by the android OS. The &#34;URI&#34; and &#xA;&#34;mime type&#34; events are sent to the application in the same way as from &#xA;other sources such as a web browser, e-mail, stand alone QR code scanner &#xA;app, etc.. So, I don&#39;t think the wallet actually knows it is receiving &#xA;the event from NFC. That is one reason why so many existing wallets &#xA;happen to support BIP21 payment request via NFC. Andreas can correct me &#xA;if I am wrong on these statements. I&#39;m a little weary sending the &#34;mime &#xA;type&#34; based format over NFC because of backwards compatibility and &#xA;because of the long certificate chain that needs to be transferred. You &#xA;want that tap to be as robust and fast as possible. A bluetooth &#xA;connection can have a retry without any user interaction.&#xA;&#xA;I don&#39;t really understand why Mike Hearn has the objections to the h &#xA;parameter. It seems like you should already be ready to produce the &#xA;BIP70 payment request at the time when the URI is generated. I&#39;d also &#xA;like to clarify that the h parameter is for more than just unsigned &#xA;payment requests. You can have a signed payment request with the wrong &#xA;signer. There is way to much brainpower required to verify that the &#xA;signer is actually the merchant you are doing business with. Just think &#xA;how many times you shop at a store that you don&#39;t even know the name of. &#xA;Also, the store may contract their payment processing out to another &#xA;party, or they may have multiple store names but use the same payment &#xA;processing system for all their stores, and the parent company has a &#xA;different name. It&#39;s good to have both the h parameter AND the signed &#xA;payment request.&#xA;&#xA;I don&#39;t really like the Airbitz proposal. Figuring out if your selecting &#xA;is the right one is a real nuisance. The idea is neat in a few &#xA;applications, but I just don&#39;t think it is going to work for people as &#xA;the most efficient and trouble free option day to day. I realize they &#xA;are probably doing it to work with Apple&#39;s limited functionality phones &#xA;(and BLE is a new buzz word). However, I don&#39;t think we should base &#xA;bitcoin around what Apple wants us to do. They&#39;ve already had their war &#xA;on bitcoin. They are going to do whatever they can to protect their NFC &#xA;based payment system. We need to make their platform the the less &#xA;desirable one if they are going to play the game that way. If that means &#xA;an Airbitz like proposal is implemented as a fallback, maybe that is &#xA;fine and POS systems need to support both, but I just don&#39;t think we &#xA;should limit what we can do because of Apple&#39;s products capabilities.&#xA;&#xA;There is also the &#34;ack&#34; memo that I mentioned in reference [2]. I think &#xA;we can improve upon this really. Can we make a new status field or &#xA;different bluetooth message header? I know Andreas didn&#39;t want to change &#xA;it because that is how his app already works, but I don&#39;t think the way &#xA;it is is ideal.&#xA;&#xA;I&#39;d like to see some discussion too about securing the bluetooth &#xA;connection. Right now it is possible for an eavesdropper to monitor the &#xA;data transferred. I&#39;d personally like to see if wrapping the current &#xA;connection with SSL works or if we can run https over a bluetooth &#xA;socket. There was some criticism of this, but I don&#39;t think it has been &#xA;tested to know if it is really a problem or not. If we just run https &#xA;over bluetooth, then a lot of my concerns about the message header &#xA;inconsistencies will go away and the connection will also be secure. We &#xA;don&#39;t have to reinvent anything.&#xA;&#xA;&#xA;&#xA;Andy Schroder&#xA;&#xA;On 02/22/2015 02:08 PM, Jan Vornberger wrote:&#xA;&gt; Hi everyone,&#xA;&gt;&#xA;&gt; I am working on a Bitcoin point of sale terminal based on a Raspberry Pi, which&#xA;&gt; displays QR codes, but also provides payment requests via NFC. It can optionally&#xA;&gt; receive the sender&#39;s transaction via Bluetooth, so if the sender wallet&#xA;&gt; supports it, the sender can be completely offline. Only the terminal needs an&#xA;&gt; internet connection.&#xA;&gt;&#xA;&gt; Typical scenario envisioned: Customer taps their smartphone (or maybe smartwatch&#xA;&gt; in the future) on the NFC pad, confirms the transaction on their phone&#xA;&gt; (or smartwatch) and the transaction completes via Bluetooth and/or the phone&#39;s&#xA;&gt; internet connection.&#xA;&gt;&#xA;&gt; You can see a prototype in action here:&#xA;&gt;&#xA;&gt;    https://www.youtube.com/watch?v=P7vKHMoapr8&#xA;&gt;&#xA;&gt; The above demo uses a release version of Schildbach&#39;s Bitcoin Wallet, so it&#xA;&gt; works as shown today. However, some parts - especially the Bluetooth stuff - are&#xA;&gt; custom extensions of Schildbach&#39;s wallet which are not yet standard.&#xA;&gt;&#xA;&gt; I&#39;m writing this post to document my experience implementing NFC and offline&#xA;&gt; payments and hope to move the discussion forward around standardizing some of&#xA;&gt; this stuff. Andy Schroder&#39;s work around his Bitcoin Fluid Dispenser [1,2]&#xA;&gt; follows along the same lines, so his proposed TBIP74 [3] and TBIP75 [4] are&#xA;&gt; relevant here as well.&#xA;&gt;&#xA;&gt;&#xA;&gt; ## NFC vs Bluetooth vs NFC+Bluetooth ##&#xA;&gt;&#xA;&gt; Before I get into the implementation details, a few words for why I decided to&#xA;&gt; go with the combination of NFC and Bluetooth:&#xA;&gt;&#xA;&gt; Doing everything via NFC is an interesting option to keep things simple, but the&#xA;&gt; issue is, that one usually can&#39;t maintain the connection while the user confirms&#xA;&gt; the transaction (as they take the device back to press a button or maybe enter a&#xA;&gt; PIN). So there are three options:&#xA;&gt;&#xA;&gt; 1. Do a &#34;double tap&#34;: User taps, takes the device back, confirms, then taps&#xA;&gt; again to transmit the transaction. (I think Google Wallet does something like&#xA;&gt; this.)&#xA;&gt;&#xA;&gt; 2. Confirm beforehand: User confirms, then taps and everything can happen in one&#xA;&gt; go. The disadvantage is, that you confirm the transaction before you have seen&#xA;&gt; the details. (I believe Google Wallet can also work this way.)&#xA;&gt;&#xA;&gt; 3. Tap the phone, then establish a Bluetooth connection which allows you to do&#xA;&gt; all necessary communication even if the user takes the device back.&#xA;&gt;&#xA;&gt; I feel that option 3 is the nicest UX, so that is what I am focusing on right&#xA;&gt; now, but there are pros and cons to all options. One disadvantage of option 3 in&#xA;&gt; practice is, that many users - in my experience - have Bluetooth turned off, so&#xA;&gt; it can result in additional UI dialogs popping up, asking the user to turn on&#xA;&gt; Bluetooth.&#xA;&gt;&#xA;&gt; Regarding doing everything via Bluetooth or maybe BLE: I have been following the&#xA;&gt; work that Airbitz has done around that, but personally I prefer the NFC&#xA;&gt; interaction of &#34;I touch what I want to pay&#34; rather than &#34;a payment request comes&#xA;&gt; to me through the air and I figure out whether it is meant for me/is legitimate&#34;.&#xA;&gt;&#xA;&gt;&#xA;&gt; ## NFC data formats ##&#xA;&gt;&#xA;&gt; A bit of background for those who are not that familiar with NFC: Most Bitcoin&#xA;&gt; wallets with NFC support make use of NDEF (NFC Data Exchange Format) as far as I&#xA;&gt; am aware (with CoinBlesk being an exception, which uses host-based card&#xA;&gt; emulation, if I understand it correctly). NDEF defines a number of record types,&#xA;&gt; among them &#39;URI&#39; and &#39;Mime Type&#39;.&#xA;&gt;&#xA;&gt; A common way of using NFC with Bitcoin is to create a URI record that contains a&#xA;&gt; Bitcoin URI. Beyond that Schildbach&#39;s wallet (and maybe others?) also support&#xA;&gt; the mime type record, which is then set to &#39;application/bitcoin-paymentrequest&#39;&#xA;&gt; and the rest of the NFC data is a complete BIP70 payment request.&#xA;&gt;&#xA;&gt;&#xA;&gt; ## Implementation ##&#xA;&gt;&#xA;&gt; To structure the discussion a little bit, I have listed a number of scenarios to&#xA;&gt; consider below. Not every possible combination is listed, but it should cover a&#xA;&gt; bit of everything.&#xA;&gt;&#xA;&gt; Scenarios:&#xA;&gt;&#xA;&gt; 1) Scan QR code, transmit transaction via Bitcoin network&#xA;&gt;     Example QR code: bitcoin:1asdf...?amount=42&#xA;&gt;&#xA;&gt; 2) Touch NFC pad, transmit transaction via Bitcoin network&#xA;&gt;     Example NFC URI: bitcoin:1asdf...?amount=42&#xA;&gt;&#xA;&gt; 3) Scan QR code, fetch BIP70 details via HTTP, post transaction via HTTP&#xA;&gt;     Example QR code: bitcoin:1asdf...?amount=42&amp;r=https://example.org/bip70paymentrequest&#xA;&gt;&#xA;&gt; 4) Touch NFC pad, fetch BIP70 details via HTTP, post transaction via HTTP&#xA;&gt;     Example NFC URI: bitcoin:1asdf...?amount=42&amp;r=https://example.org/bip70paymentrequest&#xA;&gt;&#xA;&gt; 5) Touch NFC pad, receive BIP70 details directly, post transaction via HTTP&#xA;&gt;     Example NFC MIME record: application/bitcoin-paymentrequest + BIP70 payment request&#xA;&gt;&#xA;&gt; 6) Scan QR code, fetch BIP70 details via Bluetooth, post transaction via Bluetooth&#xA;&gt;     Example QR code: bitcoin:1asdf...?amount=42&amp;bt=1234567890AB&#xA;&gt;     Payment request has &#39;payment_url&#39; set to &#39;bt:1234567890AB&#39;&#xA;&gt;&#xA;&gt; 7) Touch NFC pad, fetch BIP70 details via Bluetooth, post transaction via Bluetooth&#xA;&gt;     Example NFC URI: bitcoin:1asdf...?amount=42&amp;bt=1234567890AB&#xA;&gt;     Payment request has &#39;payment_url&#39; set to &#39;bt:1234567890AB&#39;&#xA;&gt;&#xA;&gt; Scenarios 1 and 2 are basically the &#39;legacy&#39;/pre-BIP70 approach and I am just&#xA;&gt; listing them here for comparison. Scenario 3 is what is often in use now, for&#xA;&gt; example when using a checkout screen by BitPay or Coinbase.&#xA;&gt;&#xA;&gt; I played around with both scenarios 4 and 5, trying to decide whether I should&#xA;&gt; use an NFC URI record or already provide the complete BIP70 payment request via&#xA;&gt; NFC.&#xA;&gt;&#xA;&gt; My experience here has been, that the latter was fairly fragile in my setup&#xA;&gt; (Raspberry Pi, NFC dongle from a company called Sensor ID, using nfcpy). I tried&#xA;&gt; with signed payment requests that were around 4k to 5k and the transfer would&#xA;&gt; often not complete if I didn&#39;t hold the phone perfectly in place. So I quickly&#xA;&gt; switched to using the NFC URI record instead and have the phone fetch the BIP70&#xA;&gt; payment request via Bluetooth afterwards. Using this approach the amount of data&#xA;&gt; is small enough that it&#39;s usually &#39;all or nothing&#39; and that seems more robust to&#xA;&gt; me.&#xA;&gt;&#xA;&gt; That said, I continue to have problems with the NFC stack that I&#39;m using, so it&#xA;&gt; might just be my NFC setup that is causing these problems. I will probably give&#xA;&gt; the NXP NFC library a try next (which I believe is also the stack that is used&#xA;&gt; by Android). Maybe I have more luck with that approach and could then switch to&#xA;&gt; scenario 5.&#xA;&gt;&#xA;&gt; Scenarios 6 and 7 is what the terminal is doing right now. The &#39;bt&#39; parameter is&#xA;&gt; the non-standard extension of Andreas&#39; wallet that I was mentioning. TBIP75&#xA;&gt; proposes to change &#39;bt&#39; into &#39;r1&#39; as part of a more generic approach of&#xA;&gt; numbering different sources for the BIP70 payment request. I think that is a&#xA;&gt; good idea and would express my vote for this proposal. So the QR code or NFC URI&#xA;&gt; would then look something like this:&#xA;&gt;&#xA;&gt;    bitcoin:1asdf...?amount=42&amp;r=https://example.org/bip70&amp;r1=bt:1234567890AB/resource&#xA;&gt;&#xA;&gt; In addition the payment request would need to list additional &#39;payment_url&#39;s. My&#xA;&gt; proposal would be to do something like this:&#xA;&gt;&#xA;&gt;      message PaymentDetails {&#xA;&gt;          ...&#xA;&gt;          optional string payment_url = 6;&#xA;&gt;          optional bytes merchant_data = 7;&#xA;&gt;          repeated string additional_payment_urls = 8;&#xA;&gt;            // ^-- new; to hold things like &#39;bt:1234567890AB&#39;&#xA;&gt;      }&#xA;&gt;&#xA;&gt; TBIP75 proposes to just change &#39;optional string payment_url&#39; into &#39;repeated&#xA;&gt; string payment_url&#39;. If this isn&#39;t causing any problems (and hopefully not too&#xA;&gt; much confusion?) I guess that would be fine too.&#xA;&gt;&#xA;&gt; In my opinion a wallet should then actually attempt all or multiple of the&#xA;&gt; provided mechanisms in parallel (e.g. try to fetch the BIP70 payment request via&#xA;&gt; both HTTP and Bluetooth) and go with whatever completes first. But that is of&#xA;&gt; course up to each wallet to decide how to handle.&#xA;&gt;&#xA;&gt; TBIP75 furthermore proposes to include an additional &#39;h&#39; parameter which would&#xA;&gt; be a hash of the BIP70 payment request, preventing a MITM attack on the&#xA;&gt; Bluetooth channel even if the BIP70 payment request isn&#39;t signed. This would&#xA;&gt; have also been my suggestion, although I know that Mike Hearn has raised&#xA;&gt; concerns about this approach. One being, that one needs to finalize the BIP70&#xA;&gt; payment request at the time the QR code and NFC URI is generated.&#xA;&gt;&#xA;&gt;&#xA;&gt; ## Questions ##&#xA;&gt;&#xA;&gt; My questions to the list:&#xA;&gt;&#xA;&gt; 1) Do you prefer changing &#39;optional string payment_url&#39; into &#39;repeated string&#xA;&gt; payment_url&#39; or would you rather introduce a new field &#39;additional_payment_urls&#39;?&#xA;&gt;&#xA;&gt; 2) @Andreas: Is the r, r1, r2 mechanism already implemented in Bitcoin Wallet?&#xA;&gt;&#xA;&gt; 3) Are there other comments regarding &#39;h&#39; parameter as per TBIP75?&#xA;&gt;&#xA;&gt; 4) General comments, advice, feedback?&#xA;&gt;&#xA;&gt; I appreciate your input! :-)&#xA;&gt;&#xA;&gt; Cheers,&#xA;&gt; Jan&#xA;&gt;&#xA;&gt; [1] http://andyschroder.com/BitcoinFluidDispenser/&#xA;&gt; [2] https://www.mail-archive.com/bitcoin-development%40lists.sourceforge.net/msg06354.html&#xA;&gt; [3] https://github.com/AndySchroder/bips/blob/master/tbip-0074.mediawiki&#xA;&gt; [4] https://github.com/AndySchroder/bips/blob/master/tbip-0075.mediawiki&#xA;&gt;&#xA;&gt; ------------------------------------------------------------------------------&#xA;&gt; Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server&#xA;&gt; from Actuate! Instantly Supercharge Your Business Reports and Dashboards&#xA;&gt; with Interactivity, Sharing, Native Excel Exports, App Integration &amp; more&#xA;&gt; Get technology previously reserved for billion-dollar corporations, FREE&#xA;&gt; http://pubads.g.doubleclick.net/gampad/clk?id=190641631&amp;iu=/4140/ostg.clktrk&#xA;&gt; _______________________________________________&#xA;&gt; Bitcoin-development mailing list&#xA;&gt; Bitcoin-development at lists.sourceforge.net&#xA;&gt; https://lists.sourceforge.net/lists/listinfo/bitcoin-development&#xA;&gt;&#xA;&gt;&#xA;&gt;&#xA;&#xA;-------------- next part --------------&#xA;A non-text attachment was scrubbed...&#xA;Name: 0x2D44186B.asc&#xA;Type: application/pgp-keys&#xA;Size: 1739 bytes&#xA;Desc: not available&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20150222/230a5e33/attachment.bin&gt;&#xA;-------------- next part --------------&#xA;A non-text attachment was scrubbed...&#xA;Name: signature.asc&#xA;Type: application/pgp-signature&#xA;Size: 555 bytes&#xA;Desc: OpenPGP digital signature&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20150222/230a5e33/attachment.sig&gt;</html></oembed>