Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Gavin Andresen on September 17, 2010, 06:16:14 PM



Title: Bitcoin Payment Request mime type (instead of bitcoin:URI)
Post by: Gavin Andresen on September 17, 2010, 06:16:14 PM
The bitoin URI thread (http://bitcointalk.org/index.php?topic=55) has died down, but bitcoinmarket and MtGox's spiffy "click to pay" features prompted me to think some more about payment links on web pages.

The problem with the MtGox/Bitcoinmarket solutions is that they still require you to copy&paste an address if you want to pay directly from the bitcoin client running on your machine.  My computer-phobic relatives just won't be able to do that (I can hear them saying "...BUT I DON'T HAVE A COPY BUTTON...").

But a bitcoin: URI has problems, too:
 1. It is hard to implement-- every browser has a different way of registering protocol handlers.
 2. If you don't have the protocol handler installed, clicking on the link doesn't give you any help on what to do to make it work.  (try it here (http://skypaint.com/btcpay/t.html))
 3. Looks like some software (like this forum) don't like bitcoin URIs: Donate to the Faucet (http://bitcoin:15VjRaDX9zpbA8LVnbrCAFzrVzN7ixHNsC) (that URI is bitcoin:15VjRaDX9zpbA8LVnbrCAFzrVzN7ixHNsC, the forum software is truncating it and adding http://).

Maybe a bitcoin payment request MIME type would work better; you click on a link and the web server returns a little file of type "application/bitcoin-payment-request".  Like this. (http://skypaint.com/btcpay/?to=15VjRaDX9zpbA8LVnbrCAFzrVzN7ixHNsC) Or the links on this page (http://skypaint.com/btcpay/mimepay.html).

If you're running Firefox, you get this dialog box if it doesn't know about application/bitcoin-payment-requests:
http://skypaint.com/btcpay/FirefoxDialog.jpg

On PCs, an app can add stuff to the registry to associate itself with a mime type (anybody know if browsers other than IE pay attention to those registry settings?).

Macs are similar (although I don't know the details; gotta set the mime type in the App's Info.plist, I believe...).  Anybody know about Linux?

Teaching the Bitcoin application to read the bitcoin-payment-request file would be easy, and it shouldn't be terribly hard to get it to ask an already-running Bitcoin to popup a "Send Payment To..." dialog box with fields filled in (OR get it to start itself running and then popup the dialog box).

So: whaddya think?


Title: Re: Bitcoin Payment Request mime type (instead of bitcoin:URI)
Post by: hippich on September 17, 2010, 07:16:59 PM
good idea IMHO. Another MHO - format for this payment request file should be in XML (or JSON?) for both debugging purposes and extensibility.



Title: Re: Bitcoin Payment Request mime type (instead of bitcoin:URI)
Post by: nimnul on September 18, 2010, 03:50:49 PM
Yet another idea is http://localhost:48321/?to=1e394893roewjrk&amount=3009.00 (it is actually used by one of WebMoney clients)

But it's hard to implement securely


Title: Re: Bitcoin Payment Request mime type (instead of bitcoin:URI)
Post by: mizerydearia on September 18, 2010, 05:24:26 PM
A user can manually associate an application with a mime type: http://support.mozilla.com/en-US/kb/Options+window+-+Applications+panel?style_mode=inproduct&as=u

However, I am uncertain how a linux application can pre-install mime types to be handled by firefox or other browsers such as konqueror, chromium, galeon, seamonkey, midori, opera, etc.

It will be nice when a user can click to confirm a transaction using Bitcoin as payment method and then to trigger bitcoin client to present the user with a dialog to confirm sending a specific bitcoin amount to a specific address; two clicks.


Title: Re: Bitcoin Payment Request mime type (instead of bitcoin:URI)
Post by: nimnul on September 19, 2010, 09:05:13 PM
Yet another solution is clipboard monitoring. E.g. pop up when client copies "Send XXX bitcoins to 1e30430430843989UIURIUE".


Title: Re: Bitcoin Payment Request mime type (instead of bitcoin:URI)
Post by: LZ on September 20, 2010, 03:34:59 AM
Clipboard monitoring? If a browser plugin/extension will do it - then ok, but if a client - so it is bad idea.


Title: Re: Bitcoin Payment Request mime type (instead of bitcoin:URI)
Post by: mizerydearia on September 20, 2010, 11:58:11 AM
Yet another solution is clipboard monitoring. E.g. pop up when client copies "Send XXX bitcoins to 1e30430430843989UIURIUE".

That may be difficult to implement across variety of operating systems, especially if Bitcoin client were to be implemented on portable devices.


Title: Re: Bitcoin Payment Request mime type (instead of bitcoin:URI)
Post by: Gavin Andresen on September 20, 2010, 12:41:33 PM
RE: hippich XML/JSON:
XML ain't gonna happen, and I think JSON is overkill for this.  Using the same format as the bitcoin.conf file is the right answer, I think (easy to implement, human-readable, comments allowed in the file, easy to extend as necessary).  That's what I mocked up at skypaint.com.

RE: nimnul http://localhost:.../
If you've never installed bitcoin, or bitcoin isn't running already, you get an unhelpful error message.  One advantage of a "payment request file" is many users will understand that you need something called "Bitcoin" to open a "Bitcoin Payment Request" file.

RE: mizerydearia Linux support:
In my research I briefly an across a reference to a KDE startup file to associate mime types with applications, so I think it would work nicely cross-platform if you've already installed bitcoin. (UPDATE: cross-desktop spec here (http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.18.html))

RE: nimnul clipboard monitoring:
Seems to me that's a feature for geeks, because only geeks would happen to know that if you highlight a bitcoin address when bitcoin was running you could automatically launch bitcoin.  And there's no way that would be turned on by default.  And it also seems to me clipboard monitoring is perfect for a standalone, general-purpose utility ("if selection matches any of THESE regepxs, launch THAT applications with arguments "beginpayment %{address} %{amount}" ... ).

RE: mizerydearia portable devices:
I've never programmed for Android or iPhone; anybody know how they handle non-standard MIME types?  Can apps register themselves as content handlers?



Thinking about actually implementing this, the hard part is getting a running (or just launched) Bitcoin's attention in a cross-platform way.  Using the existing command-line control (which uses JSON-RPC under the covers) would be the most straightforward, but that requires that you set a rpcuser/rpcpassword in the bitcoin.conf file AND run bitcoind or bitcoin -server.  Yuck.

I suppose, as a special case, payment request JSON-RPC calls could be allowed with no rpcpassword, and -server could be made the default.  Makes me a little nervous, though.

Running  bitcoin /path/to/browser/cache/with/payment_request_file  (which is what the web browsers will do) should:
 IF bitcoin isn't running:  launch it, and wait until it is ready to receive payment request messages
 Send running bitcoin (...somehow...) "Hey, we got a payment request here for you to deal with" messgae.


Title: Re: Bitcoin Payment Request mime type (instead of bitcoin:URI)
Post by: mizerydearia on September 20, 2010, 02:40:15 PM
Quote
<necrodearia> If I want to create a new mimetype to be handled by a cross-platform application that I am writing and to work across a variety of linux desktop environments, where would be a good place to start learning?
<roxxo> necrodearia: maybe the XDG (http://standards.freedesktop.org/basedir-spec/latest/) specification?
<loomsen> necrodearia: freedesktop.org (http://freedesktop.org/) maybe


Title: Re: Bitcoin Payment Request mime type (instead of bitcoin:URI)
Post by: Geremia on April 25, 2013, 09:27:57 PM
that URI is bitcoin:15VjRaDX9zpbA8LVnbrCAFzrVzN7ixHNsC, the forum software is truncating it and adding http://
Not if you leave out quotes, so NOT this:
Code:
[url="bitcoin:<address>"]<address>[/url]
but this:
Code:
[url=bitcoin:<address>]<address>[/url]